Why is wp_get_attachment_image_src not working with my custom size (add_image_size)

I have added an image size with

add_image_size('gallery-thumb', 48, 48);

Why when I do

Read More
array_slice(wp_get_attachment_image_src($firstimg->ID, 'gallery-thumb'))

I get the link to the full sized image?

UPDATE

Somehow it appears that even when I do

wp_get_attachment_image_src($photo->ID, array(48,48))

I get the thumbnail image (150, 150)

Related posts

Leave a Reply

2 comments

  1. I’ve been wrestling with the same issue this afternoon. The way wordpress handles thumbnails isn’t very intuitive, but it seems that:

    • Thumbnails are only generated on upload. So if you’re developing & have added a new size, you’ll need to delete and replace your media or regenerate the thumbnails with a plugin (I haven’t looked for a native solution – seems ridiculous that there isn’t one!) like Scribu suggests in order to use it.

    • The size parameter seems like it will generate thumbnails of an arbitrary size, but I believe it is actually just mapping to the closest thumbnail size that has already been generated. That’s why you’re getting 150×150 pixel thumbs back when you request 48×48 pixel thumbs.

    This article goes into much more detail:
    http://www.studiograsshopper.ch/web-development/wordpress-featured-images-add_image_size-resizing-and-cropping-demo/