SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Auto load images + thumbnails

    Hello,

    I'm new to this forum.
    And I got a question and hope you guys can help me out with it.

    I have a folder with quite some images (.jpg files) and want to display them on a webpage.
    So I want to show them as small thumbnails so the page loads faster.
    To do this manual takes to much time.

    There are many useful tricks to do with jQuery.
    I have been searching quite a lot but couldn't find the answer and so that's why I'm asking for help here.

    Any information is welcome.
    Thanks in advance.

    Greetings,
    Jan24

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The most tedious part is getting the names into a text file. Being an oldtimer, I would DIR > file.txt From there, you can manipulate it to create an array of image names, rename the file to *.js, and use it in your page
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,435
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    So I want to show them as small thumbnails so the page loads faster.
    The best way is to create a thumbnail when the original is uploaded. Either in a different folder or with a prefix like th_

    If the photos are already on your server you can use some code like GD or Imagemagick to create thumbnails of them all.

    I would use glob() to select all the thumbnails into an array and build the page from that array. You could include a link to a larger size image; this would be less than 10 lines of code in php.


Bookmarks

Posting Permissions

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