Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17

Thread: display images in a folder

  1. #16
    Join Date
    May 2013
    Quote Originally Posted by Henry07 View Post
    this is a php code
    $files = glob("images/*.*");
    for ($i=0; $i<count($files); $i++)
    $num = $files[$i];
    echo '<img src="'.$num.'" alt="random image" />'."<br><br>";

    Duplichecker - Plagiarism software

  2. #17
    Join Date
    Mar 2007
    All you need to get thumb nails is to use the getimagesize() function in conjunction with list() to obtain the height and width of the image then use a calculation to ensure that the resizing of height and width is not going to result in an image that is out of proportion.

    I used something like this for my images

    PHP Code:
    $ext = array("jpg","png","gif","bmp");
    $ext as $typ){
    $dir glob("*.{$typ}");
    $img array_combine$dir $img);

    $ratio 0.33// approx 1/3rd

    foreach($img as $thumb){
    $width$height$type$attr) = getimagesize$thumb );
    $height $height $ratio;
    $width $width $ratio;
    "<img height='{$height}' width='{$width}' title='' src='{$thumb}'; /><br>\r\n";    

    its been a long time since I looked at the script but thats the basics of what I did.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles