Jump to content

Picture Gallery Help


Xander756

Recommended Posts

I am looking for the code that will allow me to create large picture galleries where if the thumbnail is clicked it will open on the site on a page by itself. Since I have thousands of pictures it would really be a pain to have to create thousands of pages and then put the picture on each one with html. Is there a way to do this with PHP?

Link to comment
Share on other sites

<?php
$displayIMG = addslashes(strip_tags($_GET['imageiD']));
if (!ctype_digit($displayIMG)){
echo("Invalid image!");
exit();
}
?>
<!-- html section -->
<img src='images/<?php echo("$displayIMG"); ?>.gif' border='0' /><br />
<!-- Save your images as: 1.gif,2.gif etc... -->
<a href="./photos.php?imageID=1">Image 1</a><br />
<a href="./photos.php?imageID=2">Image 2</a><br />
<a href="./photos.php?imageID=3">Image 3</a><br />
<a href="./photos.php?imageID=4">Image 4</a><br />

 

Pretty basic code but will get you on track.. ;)

Link to comment
Share on other sites

On the page I want to make the thumbnail gallery (named test2.html) I have put:

 

<html>

<body bgcolor="black">

 

 

<a href="./test.php?imageid=1"><img width="250" height="250" src="images/1.jpg"></a><br />

 

 

</html>

 

Then on the page I want the picture to show up (named test.php) I put"

 

<html>

<head>

<title>Hello

</title>

</head>

 

<body bgcolor="black">

<font color="white">

 

<?php

$displayIMG = addslashes(strip_tags($_GET['imageiD']));

if (!ctype_digit($displayIMG)){

echo("Invalid image!");

exit();

}

?>

<!-- html section -->

<img src='images/<?php echo("$displayIMG"); ?>.jpg' border='0' /><br />

 

 

 

</body>

 

 

</html>

 

But I only get "Invalid Image!" when I click it.

Link to comment
Share on other sites

Okay well I got that coding to work but there is one problem. Is there anyway to edit the size of the images that makes it appear? I have some images that are like 1000x1000 others that are like 800x300 and some that are 300x800 so I can't just put one setting in the img src code. Anyway I can have it shrink to fit on a page?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.