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

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


On 09-04-11 at 10.43, scribu <scribu at gmail.com> wrote:

>Jan, maybe you should describe what you're trying to do, so that we
>have a broader picture.

OK, I might go about this in completely the wrong way so I 
better describe it.

I want to show pictures in my posts and I've got two requirements:

+   I want to be able to move site to another domain if I have to,
     so I want all urls to be relative in my posts

+   I want to use a lightbox effect but I want to use my own markup
     so it's presented the way I want - to do the lightbox 
effect I
     need to access two different sizes of the photo.

+   I don't want to "hardcode" the presentation in the entries since
     I might change my mind on how it should work later, by 
using a
     custom markup it becomes pretty easy to make such a change.

I add new posts and images using the XML-RPC interface (I never 
write anything from within WP). A post would typically look 
something like this

     bla bla bla bla bla bla bla bla bla bla
     bla bla bla bla bla bla bla bla bla bla
     bla bla bla bla bla bla bla bla bla bla

     (:photo src='rel/path/to/photo' capt='bla bla bla':)

     bla bla bla bla bla bla bla bla bla bla
     bla bla bla bla bla bla bla bla bla bla
     bla bla bla bla bla bla bla bla bla bla


I've previously implemented the same type of custom markup for 
another system and would like to keep using it (it's pretty easy 
for me to automize the generation of these tags on my laptop).

I know very little of the internal stuff of WP but as far as I 
understand I  should be able to do what I want if I could get 
the URLs to the different sizes of the photo in WP (small, 
medium, large, original) and the physical dimensions of these 
versions (I need the height/width to generate the correct 
markup) given the relative path to the original.

I hope this makes things clearer.

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



More information about the wp-hackers mailing list