display of images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

display of images

Post by lostinphp »

i have this script dat works well..it displays all the images found in a directory on a page(thumbnail images)..and clicking on each image shows the image on its larger size...the problem is dat now i need to make appear the image in the center of the page..
and add back and next buttons on the page..
can someone gimme an idea of how this can be done?
i tried doin it but i end up displaying all the images on dat directory in the same page instead of displaying image by image..
i hope im clear.
thank u
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Maybe you could load all the images filenames into an array, then display one image from the array, with the links

Code: Select all

<?php
print "<a href=\"thispage.php?showimage=".($showimage - 1)."\">Previous Image</a>
<a href=\"thispage.php?showimage=".($showimage + 1)."\">Next Image</a>
?>
They you just have to

Code: Select all

<?php
print "<img src=\"".$imagearray[$showimage]."\" alt=\"blah blah\" />";
?>
Post Reply