SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Liverpool
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do I upload two versions of the same file

    Hi,

    I've looked for ages for an answer to this, hopefully someone can help me out.

    I need to upload a jpg and place two versions of the file into a directory
    (1st reduced in size, 2nd reduced further in size (i.e. thumbnail))

    The problem I have is that I can reduce and copy the first version using move_uploaded_file(), however, I can't access the image again as it's been uploaded, is it possible to save a copy of the image for a second resize and upload ?

    Any help appreciated.

    Andy
    I was angered, for I had no shoes,
    then I met a man who had no feet.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    Hi Andy, one method is to have the upload complete and the file is on the server then make a copy of it using copy().

    So upload your big file and then make a smaller copy of it
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Liverpool
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Spike,

    Does that mean there is a copy function which allows a resize also ?
    I was angered, for I had no shoes,
    then I met a man who had no feet.

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    No, you would use copy in conjunction with an image manipulation script to create the thumbnail. Something like imagejpeg or one of the other imagecreate functions.

    Have a look through the user notes for functions.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did the same thing recently, following this method:

    1. upload the large image, move and resize to a max width
    2. using the resized large image, create the thumbnail to a max width

    There is no need to use the temp file twice.
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Liverpool
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the responses, I'll look into and let people know how I got on for future reference.
    I was angered, for I had no shoes,
    then I met a man who had no feet.


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
  •