jasonc Posted October 20, 2010 Share Posted October 20, 2010 how do i grab and print on page in date order all .jpg files in a folder ? Link to comment https://forums.phpfreaks.com/topic/216367-how-do-i-grab-and-print-on-page-in-date-order-all-jpg-files-in-a-folder/ Share on other sites More sharing options...
litebearer Posted October 20, 2010 Share Posted October 20, 2010 http://fundisom.com/phpsnippets/snip/image_listing/list_image_folder/ Link to comment https://forums.phpfreaks.com/topic/216367-how-do-i-grab-and-print-on-page-in-date-order-all-jpg-files-in-a-folder/#findComment-1124346 Share on other sites More sharing options...
jasonc Posted October 20, 2010 Author Share Posted October 20, 2010 great thanks. i have used the script on the page you gave but i also wish to show the images, but these images are stored using FTP in folder in the HOME directory not the public_html folder. I can not have these permanately stored in the public_html or folder with in due to them being seen if an unauthourised direct link was used to them. I have an admin folder in the public_html folder and this has scripts for logins, and the page shows the names of the files in the home/ftpfolder how can i make use of the images and have a smaller version of it show in the page and also allow the logged in user click the image and be shown the larger version. here is what code i have so far... $imgdir = '/home/site/ftpfolder'; // the directory, where your images are stored $allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show $dimg = opendir($imgdir); while($imgfile = readdir($dimg)) { if(in_array(strtolower(substr($imgfile,-3)),$allowed_types)) { $a_img[] = $imgfile; sort($a_img); reset ($a_img); } } $totimg = count($a_img); // total image number for($x=0; $x < $totimg; $x++) { $size = getimagesize($imgdir.'/'.$a_img[$x]); // do whatever $halfwidth = ceil($size[0]/2); $halfheight = ceil($size[1]/2); ?><img src="/home/site/ftpfolder/<? echo $a_img[$x];?>" height="100"><? echo 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />'; } Link to comment https://forums.phpfreaks.com/topic/216367-how-do-i-grab-and-print-on-page-in-date-order-all-jpg-files-in-a-folder/#findComment-1124413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.