However, the problem with that is that if the post has multiple images, but the first image in the post is not actually the one that was uploaded first, you'll end up getting the second image instead of the first one.

So, I decided to use something similar to this approach, which uses a regex to parse the_content to find the first post.

This works out fine, but I end up with the image size that was used in the post, and I only want the Thumbnail size.

So, here's the question: If I have a link to an image, is there any way I can get a different size?

Seems what I need is to somehow get the attachment ID, so that I can get the image size with this:

This is much more succinct (since it doesn't jump through the hoops of first removing the extension and then adding it back in), and is a little more accurate (since the . is escaped and the query is case sensitive).

+1 Thanks for your help. You got me thinking in the right direction. However, this is way too verbose, and is not completely accurate. I modified your idea slightly, and posted it as an answer. Thanks.
–
Joseph SilberJan 29 '12 at 20:09

As pointed out above, the problem with this method is that it'll give you the first picture uploaded - not the first picture in the post. So, if you have a picture in your post, then decide to add another one higher up in the post than the other image, your code will return the second image instead of the first one.
–
Joseph SilberJan 19 '12 at 4:55