[wp-hackers] Newbie Q - accessing different image sizes

Jan Erik Moström lists at mostrom.pp.se
Sat Apr 11 06:18:38 GMT 2009


I'm pretty new to writing wp plugins so I might be missing 
something obvious, I've been looking at the API docs but it 
feels like I'm missing some understanding of how things works.

I want to write a plugin that converts some custom tags to HTML.
In the posts there are custom tags that contains the relative 
path to an image, that is 
"wp-content/uploads/2009/04/p1010127.jpg", I want to write a 
plugin that takes this path and spits out some HTML.

My problem is that I can't figure out how to check what 
different sizes this image comes in. I would for example like to 
get the URLs and dimensions of the medium and large version but 
I have no idea on how to do that.

I looked at the attachment functions which seem to do these 
things but I don't really understand how I get from that path to 
an attachment ID (or if this is the way to it).

I would appreciate some hints on how to do this.

                             jem
-- 
Jan Erik Moström, http://mostrom.eu



More information about the wp-hackers mailing list