Solved

List Images in specified size

Posted on 2000-04-21
5
193 Views
Last Modified: 2006-11-17
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 ?
0
Comment
Question by:bazet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Expert Comment

by:mrvithan
ID: 2737268
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.
0
 
LVL 8

Expert Comment

by:us111
ID: 2737971
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);
?>
0
 

Expert Comment

by:mrvithan
ID: 2738335
Opp...... I have to study how people give some answer from us111.... :)
0
 

Accepted Solution

by:
benchun earned 50 total points
ID: 2812223
from http://www.faqts.com/

You can display an image as a different size just by setting the height
and width properties in the HTML IMG tag.  This results in the complete
file being downloaded regardless of the final image size however.  That
can make for some very large thumbnails...<g>

To adjust the image file size as well you'll need to install this lib on
your machine : Image Magick, it can be found at

    http://www.wizards.dupont.com/cristy/ImageMagick.html

Here's a quick run down from their web site:
    ImageMagickTM, version 4.2.8, is a robust collection of tools and
    libraries to read, write, and manipulate an image in any of the more
    popular image formats including GIF, JPEG, PNG, PDF, and Photo CD.
    With ImageMagick you can create GIFs dynamically making it suitable
    for Web applications.

    You can also resize, rotate, sharpen, color reduce, or add special
    effects to an image and save your completed work in the same or
    differing image format.

    Here are just a few examples of what ImageMagick can do:
         * Convert an image from one format to another (e.g. TIFF to
           JPEG)
         * Resize, rotate, sharpen, color reduce, or add special effects
           to an image
         * Create a montage of image tumbnails
         * Create a transparent image suitable for use on the Web
         * Turn a group of images into a GIF animation sequence
         * Create a composite image by combining several separate images
         * Draw shapes or text on an image
         * Decorate an image with a border or frame
         * Describe the format and characteristics of an image

The X11 libs are only required if you build the full ImageMagick
package, including the graphic viewer.  If all you're interested in is
the command-line tools, you can 'configure --without-x'

Once you install the neccessary libs, you will have a program called
"mogrifycation" which you can run from the command line. You can do all
sorts of img manipularion with this util ie resize, dither, reduce
resolution etc etc from the command line :).

So you could easily use the PHP system() call to execute the command and
get what you want.

0
 
LVL 8

Expert Comment

by:us111
ID: 2813347
????????????????
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.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL limit and not so limited 13 62
PHP Web Development 6 69
assigning javascript variable to php variable 8 69
PHP, Curl and XML 13 15
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question