473,503 Members | 8,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

resize image on client side

Hi all,

I've a classic upload form where people may select images on their computer
to send on my website.

Since this is done by people not very confortable with computers, some sent
pictures are very huge (3MB) and I do resize them anyway since I only allow
500px wide pictures.

Instead of letting people upload the 3MB file then resize it on the server,
isn't there any possibility to "reduce" the file resolution on the client's
machine then upload on the server the reduced picture using javascript or
any other method ?

Thanks for any tip
May 4 '07 #1
6 4496
rf
"Bob Bedford" <bo*@bedford.comwrote in message
news:46**********************@news.sunrise.ch...
Hi all,

I've a classic upload form where people may select images on their
computer to send on my website.

Since this is done by people not very confortable with computers, some
sent pictures are very huge (3MB) and I do resize them anyway since I only
allow 500px wide pictures.

Instead of letting people upload the 3MB file then resize it on the
server, isn't there any possibility to "reduce" the file resolution on the
client's machine then upload on the server the reduced picture using
javascript or any other method ?
No.

--
Richard.
May 4 '07 #2
On May 4, 12:57 pm, "Bob Bedford" <b...@bedford.comwrote:
Hi all,

I've a classic upload form where people may select images on their computer
to send on my website.

Since this is done by people not very confortable with computers, some sent
pictures are very huge (3MB) and I do resize them anyway since I only allow
500px wide pictures.

Instead of letting people upload the 3MB file then resize it on the server,
isn't there any possibility to "reduce" the file resolution on the client's
machine then upload on the server the reduced picture using javascript or
any other method ?

Thanks for any tip
the only ways would be to write a firefox extension, use activex for
IE (not recommended) or write an auto-upload script which doesnt use a
browser and uses something like imagemagick to crunch the images.
You could offer a .NET download to people which could resize nicely,
and then offer the upload from within the GUI which showed the ETA, it
would allow batch jobbing for more fun.
If this isnt worth it, just tell them what programs are out there
which resize and some instructions and then let them know approx times
for uploads if they don't resize first, and you could also provide the
user with some feedbck about the eta, either live, or after the
initial upload has begun you could use the filesize and approx
connection speed (you got earlier using some javascript) and show them
their eta, offering a link to the instructions page.

May 4 '07 #3
Bob Bedford wrote:
Hi all,

I've a classic upload form where people may select images on their computer
to send on my website.

Since this is done by people not very confortable with computers, some sent
pictures are very huge (3MB) and I do resize them anyway since I only allow
500px wide pictures.

Instead of letting people upload the 3MB file then resize it on the server,
isn't there any possibility to "reduce" the file resolution on the client's
machine then upload on the server the reduced picture using javascript or
any other method ?
I am going to venture an answer and say, "no."

JavaScript (without privileges) cannot write to the file system
(security and all).

Also bear in mind, size of the image is not the same thing as its width
and height.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
May 4 '07 #4
-Lost said the following on 5/4/2007 8:49 AM:
Bob Bedford wrote:
>Hi all,

I've a classic upload form where people may select images on their
computer to send on my website.

Since this is done by people not very confortable with computers, some
sent pictures are very huge (3MB) and I do resize them anyway since I
only allow 500px wide pictures.

Instead of letting people upload the 3MB file then resize it on the
server, isn't there any possibility to "reduce" the file resolution on
the client's machine then upload on the server the reduced picture
using javascript or any other method ?

I am going to venture an answer and say, "no."
Your venture is a successful one :)
JavaScript (without privileges) cannot write to the file system
(security and all).
It would need to do more than that. It would need to execute a program
on the users PC to be able to manipulate images as Javascript itself has
no means at all to modify image data.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 4 '07 #5
On May 4, 3:02 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
-Lost said the following on 5/4/2007 8:49 AM:
Bob Bedford wrote:
Hi all,
I've a classic upload form where people may select images on their
computer to send on my website.
Since this is done by people not very confortable with computers, some
sent pictures are very huge (3MB) and I do resize them anyway since I
only allow 500px wide pictures.
Instead of letting people upload the 3MB file then resize it on the
server, isn't there any possibility to "reduce" the file resolution on
the client's machine then upload on the server the reduced picture
using javascript or any other method ?
I am going to venture an answer and say, "no."

Your venture is a successful one :)
JavaScript (without privileges) cannot write to the file system
(security and all).

It would need to do more than that. It would need to execute a program
on the users PC to be able to manipulate images as Javascript itself has
no means at all to modify image data.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

There are ways this can be done as mentioned above by shimmyshack. At
the moment, probably the best way to do it is with a Java applet (for
example: http://www.radinks.com/upload/ ). If you want to write your
own, have a look at the apache commons libraries in particular
fileupload, httpclient and net.

Another possibility (and i am not sure if this would work), is the
Google Gears javascript project. This gives you access to a local
datbase which you have write access to. Assuming you can access a file
from the file input object in html, you could resize an image with
your javascript (assuming you can do this), and store it in the local
database, then upload the resized image to your server. This is all
theoretical, and i have no idea if it would work, or if it is
possible...but its an idea...

Jun 18 '07 #6
to*********@gmail.com wrote:
On May 4, 3:02 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>-Lost said the following on 5/4/2007 8:49 AM:
>>Bob Bedford wrote:
Hi all,
I've a classic upload form where people may select images on their
computer to send on my website.
Since this is done by people not very confortable with computers, some
sent pictures are very huge (3MB) and I do resize them anyway since I
only allow 500px wide pictures.
Instead of letting people upload the 3MB file then resize it on the
server, isn't there any possibility to "reduce" the file resolution on
the client's machine then upload on the server the reduced picture
using javascript or any other method ?
I am going to venture an answer and say, "no."
Your venture is a successful one :)
>>JavaScript (without privileges) cannot write to the file system
(security and all).
It would need to do more than that. It would need to execute a program
on the users PC to be able to manipulate images as Javascript itself has
no means at all to modify image data.

There are ways this can be done as mentioned above by shimmyshack. At
the moment, probably the best way to do it is with a Java applet (for
example: http://www.radinks.com/upload/ ). If you want to write your
own, have a look at the apache commons libraries in particular
fileupload, httpclient and net.
But the simple and end-all answer is "no." It cannot be done with
JavaScript alone.
Another possibility (and i am not sure if this would work), is the
Google Gears javascript project. This gives you access to a local
datbase which you have write access to. Assuming you can access a file
from the file input object in html, you could resize an image with
your javascript (assuming you can do this), and store it in the local
database, then upload the resized image to your server. This is all
theoretical, and i have no idea if it would work, or if it is
possible...but its an idea...
Sure, it is possible with XHRs and server-side. I am sure no one would
argue that. Again though, can it be done with JavaScript only? No.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 18 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
9796
by: Don | last post by:
Does anyone know where I can find a client-side function I can reference from within an HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it on the...
0
228
by: Jim Brandley | last post by:
I have a required field with a client-side validator. It works as advertised until I try to add code to block double submits and replace the image on the submit button to give the users some...
0
237
by: adam roth | last post by:
Hello, We're looking for a client-side (ActiveX) control to allow web users to resize, rotate, and manipulate images on our server without requiring a server post-back for each. Once the image...
2
1569
by: moondaddy | last post by:
I need to get the size on an image client side before the client uploads it, and if its too large, I need to alert the client rather than doing a postback. The code below successfully writes the...
1
2377
by: Steve Lloyd | last post by:
Hi, I am stuck on how I can resize and image client side before it is uploaded to the server. Basically remote users take images using a digital camera and we need them to upload them to the...
5
1661
by: thisis | last post by:
Hi All, Hi All, (this is not the same topic as the my previous topic) What objects/methods/properties does VBScript offer for: Assuring/guarantee/make certain that ASP/VBSCript an ELEMENT...
11
1859
by: Adam Sandler | last post by:
Hello, Having an issue with JavaScript in my ASP.Net page. I use some COTS, which for all intents and purposes, simply makes a jpeg file and physically places it in a directory on the web...
8
2605
by: brahmaforces | last post by:
Hi Folks, I am using cherrypy and python. I am trying to get a user profile image to resize on the client side before uploading to the server. PHP has a gd library that does it it seems. Has...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.