Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display image from server (newest-oldest) to a new php page?
    primarykey
    data
    text
    <p>i have a form that create images (using imagejpeg, imagettftext and imagecreatefromjpeg) and save it on a folder in the server. What i need to do is to display ALL created images to another page, the newest on the top and so that the oldest is at the bottom. i have a form called formdisplay.php but it's just displaying a broken image and not newest to oldest. hope you can help me with this. really need to get this working. thanks in advance for your help.</p> <p>i have read the posts but none of those worked for me.</p> <p><a href="https://stackoverflow.com/questions/15056053/pull-dedicated-images-from-folder-show-image-filename-strip-part-of-filenam">Pull dedicated images from folder - show image + filename (strip part of filename + file-extension)</a></p> <p><a href="https://stackoverflow.com/questions/6557980/how-can-i-display-latest-uploaded-image-first-phpcss">How can I display latest uploaded image first? (PHP+CSS)</a></p> <p><a href="https://stackoverflow.com/questions/8359916/getting-images-from-the-server-and-display-them">getting images from the server and display them</a></p> <p><a href="https://stackoverflow.com/questions/12795385/displaying-images-from-folder-in-php">Displaying images from folder in php</a></p> <p><a href="https://stackoverflow.com/questions/14257682/display-image-from-server-embedding-php-in-html">display image from server embedding php in html</a></p> <p>formcreatesave.php</p> <pre><code> imagecopymerge($im, $img2, 10, 350, 0, 0, imagesx($img2), imagesy($img2), 100); $date_created = date("YmdHis");//get date created $img_name = "-img_entry.jpg"; //the file name of the generated image $img_newname = $date_created . $img_name; //datecreated+name $img_dir =dirname($_SERVER['SCRIPT_FILENAME']) ."/". $img_newname; //the location to save imagejpeg($im, $img_dir , 80); //function to save the image with the name and quality imagedestroy($im); </code></pre> <p>formdisplay.php</p> <pre><code>$dir = '/home3/site/public_html/Master/uploader/uploader'; $base_url = 'http://mysite.com/Master/uploader/uploader/20131027024705-img_entry.jpg'; $newest_mtime = 0; $show_file = 'BROKEN'; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != '.') &amp;&amp; ($file != '..')) { $mtime = filemtime("$dir/$file"); if ($mtime &gt; $newest_mtime) { $newest_mtime = $mtime; $show_file = "$base_url/$file"; } } } } print '&lt;img src="' .$show_file. '" alt="Image Title Here"&gt;'; </code></pre> <p>please feel free to edit my code. thanks :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload