Link to home
Start Free TrialLog in
Avatar of bazet
bazet

asked on

List Images in specified size

Ok. I've messed with my PHP since yesterday ( I'm a beginner ) so I need your help.

I've succesfully made an upload image php script which stores images in a folder eg /home/bazet/photos
The images are random from jpg to gif. What I want is, just a page that list all the images in that folder in thumbnails ( 100 px X 100 px ) and when clicked ..it will display the real one. And I would like to display it in order ( rows ) and sorted by date .

Can you give me an example ?
Avatar of mrvithan
mrvithan

I amn't quite sure i understand your question... but if i did. You could make thumbnails by using HTML.
 
with sorting by date, using filemtime function to get last modified date is a idea, and use them to be a index. but i don't know the return value from filemtime is a timestamp or a complete day. You just try it.
The following works, it sorts by date and 100*100 pixels

<?
  $handle=opendir(".");

  // create an array
  while ($file = readdir($handle))
  {      if ((strstr($file, ".gif") <> false) || (strstr($file, ".jpg") <> false))
          $pictarray[] = filemtime($file)."~~".$file;
      }

      // sort by date
    sort($pictarray);
    for($i=0; $i<count($pictarray);$i++)
    {      $file = split("~~", $pictarray[$i]);
        $file = $file[1];
?>
        <a href="<?print $file?>"><img src="<?print $file?>" height="100" width="100" border="0"></a><br>
<?
        }
        closedir($handle);
?>
Opp...... I have to study how people give some answer from us111.... :)
ASKER CERTIFIED SOLUTION
Avatar of benchun
benchun

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
????????????????
Strange answer for the question.

I don't think you will have a powerfull php application with imageMagick.
ImageMaGick will be call by exec or system command in PHP script...

Well why not.