Connecting Tech Pros Worldwide Forums | Help | Site Map

Python Substitute for PHP GD, Resizing an image on the client side

brahmaforces
Guest
 
Posts: n/a
#1: Aug 19 '08
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 anyone done this in a
python environment without uploading to the server?

Uwe Schmitt
Guest
 
Posts: n/a
#2: Aug 19 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


On 19 Aug., 08:32, brahmaforces <brahmafor...@gmail.comwrote:
Quote:
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.
php works on the client side ?? are you sure ?
Quote:
Has anyone done this in a
python environment without uploading to the server?
if you resort to resizing on the server side, you can
use PIL.

Greetings, Uwe
Rob Weir
Guest
 
Posts: n/a
#3: Aug 19 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


On 19 Aug 2008, brahmaforces@gmail.com wrote:
Quote:
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.
PIL? http://www.pythonware.com/products/pil/.

--
-rob

Diez B. Roggisch
Guest
 
Posts: n/a
#4: Aug 19 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


brahmaforces schrieb:
Quote:
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 anyone done this in a
python environment without uploading to the server?
Everything PHP is server-side. And displaying images is *always* done
through uploading and then displaying it.

The resizing is done using JavaScript, and then communicating back the
selected rectangle to the server - *then* GD or whatnot (PIL,
ImageMagick) are used to resize the image.

Diez
brahmaforces
Guest
 
Posts: n/a
#5: Aug 19 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


Hi Everyone,

Thanks for your responses. Sorry I should have been clearer in my
question. Yes PHP is server side, and it seems that all image
processing using GD or ImageMagicks etc happens on the server.
Therefore Diez's suggestion of using javascript to select a rectangle
on the client side would be the best option and then upload this small
selection to the server and then process there.

Does anyone have any code that does the javascript "selecting the
rectangle bit" and uploading to the server. Also incidentally is ftp
or put the recommended way to go for uploading the reduced image to
the server?

Thanks...


On Aug 19, 11:54 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Quote:
brahmaforces schrieb:
>
Quote:
Hi Folks,
>
Quote:
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 anyone done this in a
python environment without uploading to the server?
>
Everything PHP is server-side. And displaying images is *always* done
through uploading and then displaying it.
>
The resizing is done using JavaScript, and then communicating back the
selected rectangle to the server - *then* GD or whatnot (PIL,
ImageMagick) are used to resize the image.
>
Diez
Diez B. Roggisch
Guest
 
Posts: n/a
#6: Aug 19 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


Does anyone have any code that does the javascript "selecting the
Quote:
rectangle bit" and uploading to the server.
I've based my work in this field on some freely available JS, but don't know
what it was called. Google is your friend here.
Quote:
Also incidentally is ftp
or put the recommended way to go for uploading the reduced image to
the server?
In the same way any other uploading is done in browsers when a website is
involved: using HTTP POST. Use the <input type="file">-tag, and make sure
the server-side will store a transmitted file properly. Frameworks such as
TurboGears (1 or 2) and Django will do that for you.


Diez
brahmaforces
Guest
 
Posts: n/a
#7: Aug 20 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


Hi Diez:
The file browse button will get me a filename on the client machine.
You are saying post will transfer the file itself? I am using straight
cherrypy no turbo gears etc, so ill have to do manually.

I have not been able to find the javascript on google despite a lot of
searching. Would appreciate some code since you mention you have
already done this...Thanks for your help

On Aug 19, 1:46*pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Quote:
Quote:
Does anyone have any code that does the javascript "selecting the
rectangle bit" and uploading to the server.
>
I've based my work in this field on some freely available JS, but don't know
what it was called. Google is your friend here.
>
Quote:
Also incidentally is ftp
or put the recommended way to go for uploading the reduced image to
the server?
>
In the same way any other uploading is done in browsers when a website is
involved: using HTTP POST. Use the <input type="file">-tag, and make sure
the server-side will store a transmitted file properly. Frameworks such as
TurboGears (1 or 2) and Django will do that for you.
>
Diez
Diez B. Roggisch
Guest
 
Posts: n/a
#8: Aug 20 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


brahmaforces wrote:
Quote:
Hi Diez:
The file browse button will get me a filename on the client machine.
You are saying post will transfer the file itself? I am using straight
cherrypy no turbo gears etc, so ill have to do manually.
You need to use POST, and some enctype-this-or-that-stuff. There is plenty
of material available on that, googling "cherrypy file upload" results in
this as first hit:

http://www.cherrypy.org/wiki/FileUpload
Quote:
I have not been able to find the javascript on google despite a lot of
searching. Would appreciate some code since you mention you have
already done this...Thanks for your help
I don't have that code handy, no idea where it is lying around. Try sharpen
your google-foo, it certainly can use it. Googling "javascript image
resizing server side" resulted in this

http://ajaxian.com/archives/iphoto-l...ing-javascript

as second hit.

I don't mind answering off-topic-questions here, but essentially these are
things better suited for HTML, JS and HTTP-fora of whatever kind.

Diez
brahmaforces
Guest
 
Posts: n/a
#9: Aug 21 '08

re: Python Substitute for PHP GD, Resizing an image on the client side


Thanks for your help Diez appreciate it!

arjuna
http://www.brahmaforces.com
Closed Thread