Wordpress正在获取自定义字段中的图像的缩略图


Wordpress getting thumnails of images in custom fields

在我当前的wordpress定制项目中,我有一些自定义的图片上传字段,用于一些自定义的帖子类型。在前端,我将使用函数get_post_meta()接收来自这些自定义字段的数据,即这些自定义图像的URL。但在这种情况下,我会通过元框上传原始的全尺寸图像。如何获取上传的元字段的缩略图。帖子类型有多个图像字段。这是我当前获取图像的代码

        $meta = get_post_meta( $post_id  );
           //print_r($meta);
            $client = $meta['client'][0];
            $channel = $meta['channel'][0];
            $logistics = $meta['logistics'][0];
            $head = $meta['headline2'][0];
            $img1 =  isset($meta['image1'])?$meta['image1']:'';//image field 1
            $img2 = isset($meta['image2'])?$meta['image2']:'';//image field 2
            $img3 = isset($meta['image3'])?$meta['image3']:'';//image field 3
Please check this link for adding images to posts.
http://justintadlock.com/archives/2007/10/27/wordpress-custom-fields-adding-images-to-posts
 OR
Try wp_get_attachment_image_src()
$attachment_id = get_field('field_name');
$size = "medium"; // (thumbnail, medium, large, full or custom size)
$image = wp_get_attachment_image_src( $attachment_id, $size );