SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Handling images for web content

    I am going to need to store a number of image files (up to 1000) of artwork on a site I am creating. I will need to display them as thumbnails (150px), medium sized images (600px) and larger images (900px). There will be occasion to show all the thumbnails on an admin page, where certain qualities are set. Otherwise, I will be displaying up to 25 150px images at a time. The large images (600px & 900px). will be displayed one at a time.

    For ease of coding, it is tempting to store them in a database field, retrieve them and size them in php (or html once the image is generated) for insertion where needed. Otherwise, I could store them in a directory and point to them after retrieving their location from a database field resizing them either with php or html. I could also create all three image sizes when uploading and store them in different directories, simply pointing to them in html, but this greatly increases required disk space.

    Any opinions of +s and -s? Speed is probably the biggest consideration. I presume resizing in html is the slowest, as it requires downloading the image before resizing it.

    Thanks,

    --Kenoli

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,436
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    I would go with option 3. Size on upload and save into different folders with the same name; you would only need one filename in the database and you could then hardcode the path into your code.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Frankfurt/Germany
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was facing a similar problem and decided to build three different qualities/sizes of an uploaded image. While processing the image, I gave it a unique id and stored additional data inside a db table (title, timestamp etc.).

    Storing an image as a blob inside a database is always a bad idea as it reduces speed and encreases db size dramatically.

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your replies. They make sense. Will follow your suggestions.


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
  •