1

I'm having a problem with the wp_get_attachment_image_src. It's not returning the url I need for the image size for my custom sizes (or any of the default sizes). It just returns the full size image every time.

I have even tried the array version of selecting the size but still doesn't work.

Here's my code:

$image = get_field('featured_image');
$image = wp_get_attachment_image_src( $image, 'product_image_size' );

When I print the $image array I get:

Array ( [0] => localhost/website/wp-content/uploads/2014/17/product-image.jpg  [1] => 117 [2] => 175 [3] => )

which shows the url for the original image I uploaded, not the resized version, and I've checked the resized version is in the upload folder.. [1] and [2] are the right sizes for this images size. This is the same when I try thumbnail and [1] and [2] equal 150 but the URL is still the original image

I am using simple image sizes plugin to create the images sizes and regenerate the thumbnails.

I am also using WPML media plugin which I did think may of been affecting it but now not to sure

Any help with this would be greatly appreciated

Josh Pyzer
  • 65
  • 3
  • 9

1 Answers1

0

Try this:

$image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'product_image_size');
Laszlo
  • 1