i have created an image upload page in my web site which stores the images on the server using php. i now need to get the images to display on a different page. here is the code i have used to set a variable to the file directory

// the new thumbnail image will be placed in images/thumbs/ folder
$thumb_name='image/thumbs/thumb_'.$image_name;
// call the function that will create the thumbnail. The function will get as parameters
//the image name, the thumbnail name and the width and height desired for the thumbnail
$thumb=make_thumb($newname,$thumb_name,WIDTH,HEIGHT);
}} }}

i now need to be able to display the uploaded in=mages on a different page for the user to be able to view what they have uploaded. i have got the images to show a preview on the first page by using this code

if(isset($_POST) && !$errors)
{
echo "<h5>Thumbnail created Successfully!</h5>";
echo '<img src="'.$thumb_name.'">';
}

?>

i thought i would be able to use img src line of code to display the images on a different page but this has not worked. I know this is probably the wrong wat hence the reason i am not getting the images displayed.

it would be much appreciated if someone could help me out with this code. this is all need to fix for the site to be finished and uploaded. i have tried to research this myself but have had no joy.

Variable $thumb_name exists only in the current page, on any other page this variable will be null. To show the image on any other page, you need to save this location in database or file. And on other page, get the image path from database/file and display it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.