Reputation: 1297
For some reason wp_get_attachment_image_src is returning wrong dimensions! Not sure why. The file exists and the image size is registered in setup. Does anyone have an idea? I am going crazy here.
Code:
# in setup function
add_image_size('thumb', 400, 0, false);
# in template file
$image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumb', false);
Result:
array(4) {
[0]=>
string(115) "http://example.com/wp-content/uploads/2013/06/this-is-an-image-400x331.jpg"
[1]=>
int(150)
[2]=>
int(124)
[3]=>
bool(true)
}
Upvotes: 1
Views: 2023
Reputation: 897
Does changing the third parameter thumb to thumbnail, in the wp_get_attachment_image_src()
function, help because the manual talks about 4 options as far as the size is concerned. (viz. thumbnail, medium, large or full).
Also consider changing the first parameter in add_image size
because it is a reserved term / word, as mentioned in the manual.
Upvotes: 0
Reputation: 10142
This is because the name thumb is Reserved Image Size.
Reserved Image Size Names:
See the Docs
Upvotes: 2