Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: image captions in a gallery

by barrd (Abbot)
on Oct 20, 2003 at 14:00 UTC ( #300589=note: print w/replies, xml ) Need Help??

in reply to image captions in a gallery

Hi bakunin,
As davido points out above this is more a HTML question than perl but I'll bite anyway and try and help. You'll be wanting something not entirely unlike below yes?

Image 1 Image 2 Image 3
Caption 1 Caption 2 Caption 3

Well to code a table like that you need HTML something like:

<table width="100%" border="2" cellspacing="1" cellpadding="4"> <tr><td align="center"> <b>Image 1</b> </td><td align="center"> <b>Image 2</b> </td><td align="center"> <b>Image 3</b> </td></tr> <tr><td align="center"> Caption 1 </td><td align="center"> Caption 2 </td><td align="center"> Caption 3 </td></tr> </table>

Obviously you can change the content of the tags to meet your requirements. Achieving this in perl is as always a TMTOWTDI scenario, but you probably want to be looking at A quick heads up though, read the dox carefully as the tr tag using this system will give you results you didn't expect otherwise (hint: Tr).

How you incorporate a loop to go through images placing them in table cells then matching the caption text is another topic you'll need to think about but hopefully the above will get you started down the road to success.

Good luck and happy coding.

Replies are listed 'Best First'.
Re: Re: image captions in a gallery
by bakunin (Scribe) on Oct 20, 2003 at 16:07 UTC
    Thank you for your nice reply barrd. I had already done what you have suggested.
      Hi again bakunin,
      Thank you for your nice reply barrd. I had already done what you have suggested.
      No problem, and thank you too.

      Heres another tip, if you haven't seen, used or tried HTML::Template I'd really recommend you do so. Since using it my life has improved about 1000%, and I mean that seriously. Theres a plethora of other modules that interact with it and you can do some really funky things. Basically it allows you to extract the HTML from your Perl code leaving both to do what they do best without lots of ugly code in your scripts. Have a look, you won't regret it.

        Agreed. Can't recommend HTML::Template enough. Recently created a image album system that allows the user to upload images after creating an "album", with description, to put them in. They can select size and optimization level, and enter a caption. Everything is stored in a MySQL db and GD handles the thumbnails and sizing (though not happy with the quality of the optimization, even in a 2.+ version).

        H::T allows me to just plug the image path and caption for each image, keeping the HTML entirely separate from the Perl/CGI. So, you can design your HTML document the way you want it to look, per barrd's suggestion, and then drop in the H::T "placeholders" for the images and captions.

        Sample site

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://300589]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2018-04-22 03:34 GMT
Find Nodes?
    Voting Booth?