I need a small php page done, simple script. Only 1 page, reading from an external folder eg: domainname.com/imagefolder. all images resize to 500px widht if its less than 500px ignore. and the height is 400px if its less ignore. auto border, and thin line for all images, ? and i dont know how the image extension going to read.. i want .jpg and .gif to be read. Please view the image for more infor.. http://www.hfolder.com/nal/php_image_display_page.gif Need clear coded with comments , please answer here or you can pm me. Thank you,,
No need to pay amount , here is the code which can help you <?php session_start(); $foldername="give path for your imagedirectory"; $NBFile=0; if ($handle = opendir($foldername)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if ( (substr($file, strlen($file)-3, 3)=="jpg" ) || ((substr($file, strlen($file)-3, 3)=="gif" ))){ $FileArray[] = $file; $NBFile=$NBFile+1; } } } } closedir($handle); ?> <html><head></head><body> <Center><table><tr> <?php $NBPicswidth=400; $NBPicsheight=400; $NBPics=0; $NBFile=$NBFile-1; for ($i=0; $i<=$NBFile; $i++) { $Pic_Name1=$FileArray[$i]; ?><td> <img border="1" src="<?php echo $Pic_Name1; ?>" align="middle" width="400" height="200"> <p align="center" style="margin-top: -2; margin-bottom: 5"><?php echo $Pic_Name1; ?></td><?php $NBPics=$NBPics+1; if ( $NBPics==$NBPicswidth ) { $NBPics=0; ?><tr><?php } } ?> </table></body></html> Code (markup): ping me back if it helps happy coding .....
adrevol Thank you very much for your coding, Its very nice of you,, I think i made a mistake,,? the php file here http://www.hfolder.com/readimages/index.php (I have added this link for the folder path, inside u r coding $foldername="http://www.hfolder.com/myimages"; my folder path is http://www.hfolder.com/myimages/ But i m getting an error ? please help me. Thank you
Well I have made a change now, changes the path like this: $foldername="/home/hfolder/public_html/myimages"; and now i can view just empty boxes, and image dosent goto next line and no line what am i doing wrong here? Please help
<?php session_start(); $foldername="imagesfol/"; $NBFile=0; if ($handle = opendir($foldername)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if ( (substr($file, strlen($file)-3, 3)=="jpg" ) || ((substr($file, strlen($file)-3, 3)=="gif" ))){ $FileArray[] = $file; $NBFile=$NBFile+1; } } } } closedir($handle); ?> <html><head></head><body> <table><tr> <?php $NBPics=0; $NBFile=$NBFile-1; for ($i=0; $i<=$NBFile; $i++) { $Pic_Name1=$FileArray[$i]; ?><tr><td> <p style="padding:5px 5px 5px 5px;border:1px solid #000000;background-color:#FFFFD9"> <img border="1" src="<?php echo $foldername.$Pic_Name1; ?>" align="middle" width="150" height="100" > <p align="center" style="margin-top: -2; margin-bottom: 5"><?php echo $Pic_Name1; echo " (".ceil(filesize($foldername.$Pic_Name1) / 1024 )." KB)"; ?></p></td></tr><?php clearstatcache (); $NBPics=$NBPics+1; } ?> </table></body></html> Code (markup): i m absolutely sorry Nals, i did't logged in for last 2days .. i m absolutely sorry for the inconvinience, please check the refined code ,.. i bet this will surely work
the problem with the old code was .. it was pointing to the root path while displaying the image ,, right click and go to properties then u will come to know.. Just add the folder name before printing the image name that will work <img border="1" src="<?php echo $Pic_Name1; ?>" align="middle" width="150" height="100" > Code (markup): here if you oberser the image path will be pointed to root : modified code is <img border="1" src="<?php echo $foldername.$Pic_Name1; ?>" align="middle" width="150" height="100" > once again sorry for the delay ...
i finished coding that is the final result urlearn.com/listimages/myimages3.php urlearn.com/listimages/myimages.php urlearn.com/listimages/myimages2.php do u need any changes?
urlearn , like this one http://urlearn.com/listimages/myimages.php is that using a .css ?? Thanks for your time
yes it is using css but for the background only this is the code: zshare.net/download/652835607e3d2e/