Jump to content

create image gallery with php


sonita

Recommended Posts

hello myweb need a image gallery for introduction myproduct to the customer. I like the pictures on my web pages to be:Pictures as a thumbnail in my home and when I click on it, the image another page with content relevant to veto a larger picture displayed beThis is my code but it does not run the picture does not show

<?php    $flag = true;    $vars = array('height', 'width', 'items');    foreach($vars as $var){	    if(!isset($_GET[$var]) || $_GET[$var] == '' or !is_numeric($_GET[$var])){		    $flag = false;	    }    }    if(!$flag) {	    header('location: main.php');	    exit();    }    $thumbs = scandir('thumbs');    foreach($thumbs as $thumb) {	    $ext = pathinfo('thumbs/' . $thumb, PATHINFO_EXTENSION);	    if(strtolower($ext) == 'jpg') {		    unlink('thumbs/' . $thumb);	    }    }$images = scandir('images');    foreach($images as $image) {	    $ext = pathinfo('images/' . $image, PATHINFO_EXTENSION);	    if(strtolower($ext) == 'jpg') {		    $src = imagecreatefromjpeg('images/' . $image);		    $dst = imagecreatetruecolor($_GET['width'], $_GET['height']);		    imagecopyresized($dst, $src, 0, 0, 0, 0, $_GET['width'], $_GET['height'], imagesx($src), imagesy($src));		    imagejpeg($dst, 'thumbs/' . $image, 100);		    imagedestroy($src);		    imagedestroy($dst);	    }    }    echo '<table border="0px" width="75%">' . PHP_EOL;    $thumbs = scandir('thumbs');    $count = 0;    foreach($thumbs as $thumb) {	    $ext = pathinfo('thumbs/' . $thumb, PATHINFO_EXTENSION);	    if(strtolower($ext) == 'jpg') {		    if($count == 0) {			    echo '<tr align="center" valign="middle">' . PHP_EOL;		    }echo '<td>';		    echo '<a href="' . ADDR . '/images/' . $thumb . '">';		    echo '<img src="' . ADDR . '/thumbs/' . $thumb . '"/>';		    echo '</a>';		    echo '</td>';		    $count++;		    if($count == $_GET['items']) {			    echo '</tr>' . PHP_EOL;		    }	    }    }  if($count !=0 ){	    while($count < $_GET['items']) {		    echo '<td> </td>';		    $count++;	    }	    echo '</tr>' . PHP_EOL;    }    echo '</table>' . PHP_EOL;?>

why?What can I do to show my pictures as I said above.My website is an e-store, and the gallery is so that I can use on this web site. but i don`t know?

Link to comment
Share on other sites

I want the gallery to an electronics store.Show thumbnails of images on a page, then click on the image to enlarge it with relevant content to be displayed. For example, the price of the product, material, and other items related to the product ....What do I do to make photo gallery for my website?I would like the following website:http://www.lzjindun.com/en/index.aspx

Link to comment
Share on other sites

If you want to try to fix the code you posted then you need to turn on error messages like I showed to look for errors. That code looks inside directories called thumbs and images and gets all JPG files from images, creates thumbnails for them, and displays them. It requires some settings in the URL also. If you want to use that other slideshow, here it is: http://www.lzjindun.com/en/gd.aspx You can look at the code on that page, they just built a table with their images and then used some Javascript on the bottom to make them scroll.

Link to comment
Share on other sites

First you need to focus on one thing. You keep asking about different things. Find a gallery you want to use first. Do a search for Javascript photo galleries, you'll find a lot of examples with descriptions about how to set them up.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...