Connecting Tech Pros Worldwide Forums | Help | Site Map

how to resize images locally before uploading to server?

Newbie
 
Join Date: Jun 2007
Posts: 4
#1: Jun 20 '07
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:
imagecreatefromjpeg("C:\Documents and Settings\nxxxx\Desktop\button.jpg");
Results:
Warning: imagecreatefromjpeg(C:\Documents and Settings\nxxxx\Desktop\button.jpg): failed to open stream: No such file or directory
The file reference is correct....

ronnil's Avatar
Expert
 
Join Date: Jun 2007
Posts: 132
#2: Jun 20 '07

re: how to resize images locally before uploading to server?


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
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#3: Jun 21 '07

re: how to resize images locally before uploading to server?


Heya, snaeher.

Use double-slashes in your file path:

Expand|Select|Wrap|Line Numbers
  1. imagecreatefromjpeg("C:\\Documents and Settings\\nxxxx\\Desktop\\button.jpg");
  2.  
ronnil's Avatar
Expert
 
Join Date: Jun 2007
Posts: 132
#4: Jun 22 '07

re: how to resize images locally before uploading to server?


Quote:

Originally Posted by pbmods

Heya, snaeher.

Use double-slashes in your file path:

Expand|Select|Wrap|Line Numbers
  1. imagecreatefromjpeg("C:\\Documents and Settings\\nxxxx\\Desktop\\button.jpg");
  2.  

Yeah, but only on a local server right? Otherwise this is a sweet hax for the max_upload_size (or whatit'scalled) setting ;P
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#5: Jun 22 '07

re: how to resize images locally before uploading to server?


Quote:

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.
Newbie
 
Join Date: Jun 2007
Posts: 4
#6: Jun 27 '07

re: how to resize images locally before uploading to server?


Ok. Thanks!

Appreciate the help. :)

Quote:

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.

Newbie
 
Join Date: Jun 2007
Posts: 1
#7: Jun 28 '07

re: how to resize images locally before uploading to server?


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.
Reply