how to resize images locally before uploading to server?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • snaeher
    New Member
    • Jun 2007
    • 4

    #1

    how to resize images locally before uploading to server?

    Functions using file references to images on my local drive return the file not found warning. The functions work fine if the image has been uploaded to the server, but returns errors when calling information for an image residing on the local drive.

    I'm attempting to reduce the upload time for large pictures.

    Any thoughts? :)

    EXAMPLE

    Function call:
    imagecreatefrom jpeg("C:\Docume nts and Settings\nxxxx\ Desktop\button. jpg");

    Results:
    Warning: imagecreatefrom jpeg(C:\Documen ts and Settings\nxxxx\ Desktop\button. jpg): failed to open stream: No such file or directory

    The file reference is correct....
  • ronnil
    Recognized Expert New Member
    • Jun 2007
    • 134

    #2
    you're gonna need some extensions to php if you want to access your local file-system.

    If you ask me it's not worth the trouble just for minimizing some bandwidth... instead put a max upload size on the images.... for instance 100kb should be more than enough for your normal webimaging needs

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, snaeher.

      Use double-slashes in your file path:

      [code=php]
      imagecreatefrom jpeg("C:\\Docum ents and Settings\\nxxxx \\Desktop\\butt on.jpg");
      [/code]

      Comment

      • ronnil
        Recognized Expert New Member
        • Jun 2007
        • 134

        #4
        Originally posted by pbmods
        Heya, snaeher.

        Use double-slashes in your file path:

        [code=php]
        imagecreatefrom jpeg("C:\\Docum ents and Settings\\nxxxx \\Desktop\\butt on.jpg");
        [/code]
        Yeah, but only on a local server right? Otherwise this is a sweet hax for the max_upload_size (or whatit'scalled) setting ;P

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Originally posted by ronnil
          Yeah, but only on a local server right? Otherwise this is a sweet hax for the max_upload_size (or whatit'scalled) setting ;P
          Ooh, hey, look at that. Good thing I read the OP :[

          Yeah, I have to agree with ronnil. You can't access files on your Users' local hard drives because PHP is server-side. Your Users have to uploaded them first before you can touch them.

          Comment

          • snaeher
            New Member
            • Jun 2007
            • 4

            #6
            Ok. Thanks!

            Appreciate the help. :)

            Originally posted by pbmods
            Ooh, hey, look at that. Good thing I read the OP :[

            Yeah, I have to agree with ronnil. You can't access files on your Users' local hard drives because PHP is server-side. Your Users have to uploaded them first before you can touch them.

            Comment

            • Alan Harries
              New Member
              • Jun 2007
              • 1

              #7
              If you really want to resize an image client side you will have to use something like a Java applet or ASP. I do know that JavaScript won’t do it. The most common, and simplest, solution is to set a limit on the file size.

              Comment

              Working...