Jump to content

Placing Text Under Images In Gallery


robyngae

Recommended Posts

I have a script that will display my thumbnails in a table and I wish to have the name of the file underneath plus a delete option, I would like a button for this but I have got the text so that will do.The connections are correct it deletes the right file from thumbs and originals but it comes out on top of the images instead of under each one.It doesn't matter if the images are in a list but they do need the name underneath.Here is the code.<?php $images = "thumbs/"; # Location of small versions $big = "graphics/"; # Location of big versions (assumed to be a subdir of above) $cols = 4; # Number of columns to display if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $colCtr = 0; echo '<table align= "center" width="80%" cellspacing="3"><tr>'; foreach($files as $file) { if($colCtr %$cols == 0) echo '</tr><tr><td colspan="4"><hr /></td></tr><tr>'; echo '<td align="center"><a href="' . $big . $file . '"><img src="' . $images . $file . '" /></a></td>'; echo $file . ' <a href="delete.php?f=' . urlencode($file) . '">Delete</a></li>'; $colCtr++; } echo '</table>' . "\r\n"; ?> Robyn

Link to comment
Share on other sites

Here is a CSS method that uses no tables.you will need to add your php code and the html together, but you should be able to do that easily.http://jlhaslip.com/samples/gallery/thumbs/index.html
Thanks for your assistance, your belief in my capabilities is way above mine, I have no idea where to put the php code, I played around a bit and completely stuffed it up.Robyn
Link to comment
Share on other sites

Here is a CSS method that uses no tables.you will need to add your php code and the html together, but you should be able to do that easily.http://jlhaslip.com/samples/gallery/thumbs/index.html
I have been playing around some more and at least it is getting closer, I now have the file name and delete beside each image so the problem is obviously in my php code.I haven't touched the top section of the code but here is the middle bit. <body> <div id="wrapper"> <div id="header"> <h1><img src="images/DeleteGraphicsHeader.gif" width="750" height="200" /> </h1> <h2>DELETE IMAGES </h2> <!-- header --> </div><!-- header --> <div id="page_contents"> <ul class="imagelist"> <?php $images = "thumbs/"; # Location of small versions $big = "graphics/"; # Location of big versions (assumed to be a subdir of above) if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $colCtr = 0; foreach($files as $file) { echo '<a href="' . $big . $file . '"><img src="' . $images . $file . '" /></a>'; echo $file . ' <a href="delete.php?f=' . urlencode($file) . '">Delete</a></li>'; $colCtr++; } ?> </ul> </div> <div id="footer"> <a href="Mailto:jlhaslip@yahoo.ca" title="send an email to:jlhaslip [ AT ] yahoo [ DOT ] ca">jlhaslip@yahoo.ca</a> <a href="http://validator.w3.org/check?uri=referer">validate the xhtml</a> ~ Centred Footer Info Here ~ <a href= "http://jigsaw.w3.org/css-validator/">validate the css</a> </div><!-- footer --> </div><!-- wrapper --> </body></html>
Link to comment
Share on other sites

Where is your opening <li> tag?And throw in a <br /> tag where you need a new line.
Thank you I compared the original with what I had and realised that I had left the <li> out and put in a <br>, I now get them in a straight line under one another but will get back to working on it today. Thank you so much for your assistance I freaked when I saw the CSS but when I calmed down and went through it I was able to change colours and sizes so learning more every day.Robyn
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...