I'm have a problem with the wp_get_attachment_image_src function returning the incorrect url for an image.
My code looks like this:
$image_main_ar = wp_get_attachment_image_src( $image_ID, 'product_image_main' );
product_image_main is a registered image size:
add_image_size( 'product_image_main', 334, 385, false );
but when I print the $image_main_ar array I get:
Array (
[0] => http://www.website.com/wp-content/uploads/2011/07/Screen-shot-2011-07-27-at-15.03.07.png
[1] => 334
[2] => 226
[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, and the dimension in the array are correct for the resized version.
The weird thing is the fourth key in the array [3] is empty, but on the images where it returns the correct url it is set to '1'. I've looked in the docs but can't find anything about this fourth value.
Does anyone have any ideas?
Many thanks for any advice.
wp_get_attachment_image_src
work with other, built in sizes? Are you calledadd_image_size
on its own? Or hooked into something likeafter_setup_theme
?