【发布时间】:2012-11-20 11:56:05
【问题描述】:
我使用自定义字段photo 上传图片。在前端,我使用以下代码获取其 URL:
$imgid=get_post_meta($post->ID, 'photo', true);
$img=wp_get_attachment_image_src($imgid);
$imgurl=$img[0];
现在我想使用 the_post_thumbnail() 的标准 WP 尺寸(缩略图、中号、...)来显示它。
我尝试了一些不起作用的解决方案:
the_post_thumbnail('medium', array('src' => $imgurl));
或
the_post_thumbnail('medium', $img);
有什么想法吗?
【问题讨论】: