paulareno Posted July 7, 2008 Share Posted July 7, 2008 Hi, I'm looking for the most simplest solution, i would just like something where i can place the images i want into a folder and a php script makes clickable thumbnails on page, but i want it so more images can be added later without having to generate the page through a software again. If any of that makes sense i hope someone can help. Thanks, Paul Quote Link to comment Share on other sites More sharing options...
Wolphie Posted July 7, 2008 Share Posted July 7, 2008 What do you mean, without being generated by a software again? Quote Link to comment Share on other sites More sharing options...
paulareno Posted July 7, 2008 Author Share Posted July 7, 2008 The only way i know of making a photo album is through dreamweaver and in order to add new pictures you need to delete the original page and re make that page. Wow that was a snappy reply thx Quote Link to comment Share on other sites More sharing options...
john-formby Posted July 7, 2008 Share Posted July 7, 2008 This is what I would do: 1. Have a form script that uploads an image and creates a thumbnail and resized large image. Store the image names in a database table 2. Have a page that queries the database and displays all the thumbnail images. These would be hyperlinked images that load a large version of the image in a new page. 3. Have a page to display the large version of the image. You can add an extra level of complexity by adding pagination to display a few thumbnails per page. Hope this helps Quote Link to comment Share on other sites More sharing options...
paulareno Posted July 7, 2008 Author Share Posted July 7, 2008 Thank you for the suggestion i will see what i can dig up, im not to good with coding or db's yet but im sure i will figure it out. Thanks paul Quote Link to comment Share on other sites More sharing options...
Wolphie Posted July 7, 2008 Share Posted July 7, 2008 This is not true, you don't have to 're-make' the page, you only need to refresh it, unless you use JavaScript, an in which case would allow you to use Ajax to automatically query the script every 5 minutes or something for new images. A simple example: <?php $dir = dir('images'); while (($file = $dir->read()) !== false) { if(($file != '.') || ($file != '..')) { print '<img src="' . $file . '" border="0" />'; } } $dir->close(); ?> This is just a very basic example of how to list files in a directory. In order to dynamically resize an image to create the thumbnail, you would have to use GD Library, or ImageMagik. You could also upload the images into a BLOB on a database, or just store the image paths. The possibilities are endless, it may be tough although it's worth learning! Quote Link to comment Share on other sites More sharing options...
craygo Posted July 7, 2008 Share Posted July 7, 2008 Check this page out http://www.phpfreaks.com/forums/index.php/topic,191541.0.html Look at the second code section. I does pretty much what you are looking for. Ray Quote Link to comment Share on other sites More sharing options...
paulareno Posted July 7, 2008 Author Share Posted July 7, 2008 Im not sure why but when i try both of the codes suggested all i get is this. Since it does the same thing with both codes maybe it has something to do with xampp which i am using for my testing server? Quote Link to comment Share on other sites More sharing options...
craygo Posted July 7, 2008 Share Posted July 7, 2008 You also need to make sure permissions are correct for the folder you want to access. Quote Link to comment Share on other sites More sharing options...
paulareno Posted July 7, 2008 Author Share Posted July 7, 2008 permissions are good checked them already Quote Link to comment Share on other sites More sharing options...
craygo Posted July 7, 2008 Share Posted July 7, 2008 Can you post what you have for code. Quote Link to comment Share on other sites More sharing options...
paulareno Posted July 7, 2008 Author Share Posted July 7, 2008 Asin the code im using to display the images? If so this is what i have at the moment <?php $dir = dir('images\pics'); while (($file = $dir->read()) !== false) { if(($file != '.') || ($file != '..')) { print '<img src="' . $file . '" border="0" />'; } } $dir->close(); ?> but i also tried the code you suggested <?php $files = glob('images/*.jpg'); foreach($files as $f){ echo "<img src=\"imageresize.php?maxsize=200&source=".$f."\" />\n"; } ?> Quote Link to comment Share on other sites More sharing options...
craygo Posted July 7, 2008 Share Posted July 7, 2008 ok couple thing to fix if you want to use first code then fix like so <?php $dir = dir('images/pics/'); while (($file = $dir->read()) !== false) { if(($file != '.') || ($file != '..')) { print '<img src="' . $dir->path.$file . '" border="0" />'; } } $dir->close(); ?> Even though you are setting the directory to read you still have to point to the directory for the image source. second code, looking at the code above, you forgot the pics folder <?php $files = glob('images/pics/*.jpg'); foreach($files as $f){ echo "<img src=\"imageresize.php?maxsize=200&source=".$f."\" />\n"; } ?> Ray Quote Link to comment Share on other sites More sharing options...
paulareno Posted July 7, 2008 Author Share Posted July 7, 2008 very strange, only loaded the first picture then the rest came up with the same thing as earlier so i tried it in internet explorer and it all worked perfectly fine, i am using the newer version of firefox maybe this has something to do with it. I see you corrected my mistakes with the slashes lol my bad it's late and im tired Thank you for your time and help, i will continue to troubleshoot the images with firefox tomorrow when my brain is awake again and i will try uploading it to my web server as my testing server can be a little silly at times. *****EDIT****** Just checked the picture formats and it turns out that the first one that loaded was a jpeg and the rest were png, Lmao so simple but yet so complicated . but still doesn't explain why it loaded in ie and not firefox ??? hmmmm Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.