By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,526 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?
Aug 19 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On 19 Aug., 08:32, brahmaforces <brahmafor...@gmail.comwrote:
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 ?
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
Aug 19 '08 #2

P: n/a
On 19 Aug 2008, br**********@gmail.com wrote:
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

Aug 19 '08 #3

P: n/a
brahmaforces schrieb:
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
Aug 19 '08 #4

P: n/a
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:
brahmaforces schrieb:
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
Aug 19 '08 #5

P: n/a
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.
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
Aug 19 '08 #6

P: n/a
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:
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.
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
Aug 20 '08 #7

P: n/a
brahmaforces wrote:
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
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
Aug 20 '08 #8

P: n/a
Thanks for your help Diez appreciate it!

arjuna
http://www.brahmaforces.com
Aug 21 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.