Jump to content

PHP to create a gallery


Chris_Elevare

Recommended Posts

Hi,

 

I'm looking to display a few very basic images on my website which are listed as thumbnails and then enlarge when clicked on. I've seen gallery scripts but they all seem to do far more than I need! I don't want people to comment on them or rate them etc.

 

I just want people to open an image form a thumbnail.

 

Thanks

 

Chris

Link to comment
https://forums.phpfreaks.com/topic/95941-php-to-create-a-gallery/
Share on other sites

If you want the thumbnails generated from the full size images by php, you might take a look at the book "object-oriented php". If you go to the publisher's website (nostarch.com), and find the files associated with the book, chapter 6 has code that you can use with some minor modifications. The down-side to doing this is that with many pictures, or pictures that are very large, processing time can be quite long. (much of this depending on how large you set the thumbnails in size).

  • 4 weeks later...

If you are not very into object-oriented php, which I am not (although it seems like I should be), I may be able to help.

 

It really depends whether or not the list of images is dynamic.  If the list is going to change, I would use PHP and MySQL (or some other database) to display the images.  The code is not very hard if you know just a little bit.

 

You could use <div></div> and javascript.  You can use getElementById to replace the image with a larger one when clicked on.  Or, you could just use a

<a href="imagename" target="_blank"><img src="imagelink" /></a>

  I personally think the javascript would be the best way to go if it is not dynamic.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.