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
Solved

List Images in specified size

Posted on 2000-04-21
5
191 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why will this INSERT statement not insert the date? 2 20
What is wrong with this PDO Delete Query? 2 17
Inserting data into database 10 35
check mysql insert 12 26
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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…
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 a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 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