Simplepie iTunes 选择特定类

发布于 2024-09-07 07:56:45 字数 742 浏览 2 评论 0原文

我正在解析 iTunes feed,该 feed 中有 3 种图像大小,我不知道如何获取最大的一个。

iTunes Feed 示例:

                <im:image height="53">http://a1.image.53x53-50.jpg</im:image>

                <im:image height="75">http://a1.image.75x75-65.jpg</im:image>

                <im:image height="100">http://a1.image.100x100-75.jpg</im:image>

我的类:

function get_app_image() 
{
    $data = $this->get_item_tags(SIMPLE_NAMESPACE_IM, 'image');
    return $data['0']['data'];
}

php 输出图像:

<img src="<?php echo $item->get_app_image(); ?>" class='alignleft1' height="100" width="100" />

它总是输出第一个/最小的图像,我不确定如何定义最大的?

I'm parsing an iTunes feed, there are 3 image sizes within the feed and I'm not sure how to fetch the largest one.

The iTunes Feed example:

                <im:image height="53">http://a1.image.53x53-50.jpg</im:image>

                <im:image height="75">http://a1.image.75x75-65.jpg</im:image>

                <im:image height="100">http://a1.image.100x100-75.jpg</im:image>

My class:

function get_app_image() 
{
    $data = $this->get_item_tags(SIMPLE_NAMESPACE_IM, 'image');
    return $data['0']['data'];
}

php to output the image:

<img src="<?php echo $item->get_app_image(); ?>" class='alignleft1' height="100" width="100" />

It always outputs the first/smallest image, and I'm not sure how to define the largest?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜访吸血鬼 2024-09-14 07:56:45

解决方案非常简单。将 $data['0'] 更改为 data['2'] ,它表示同一命名空间的第三个图像。

The solution was very simple. Change $data['0'] to data['2'] which represented the 3rd image of the same namespace.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文