Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

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

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


brahmaforces at gmail

Aug 18, 2008, 11:32 PM

Post #1 of 9 (435 views)
Permalink
Python Substitute for PHP GD, Resizing an image on the client side

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?
--
http://mail.python.org/mailman/listinfo/python-list


rocksportrocker at googlemail

Aug 18, 2008, 11:41 PM

Post #2 of 9 (409 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

On 19 Aug., 08:32, brahmaforces <brahmafor...@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.

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
--
http://mail.python.org/mailman/listinfo/python-list


rweir at ertius

Aug 18, 2008, 11:43 PM

Post #3 of 9 (410 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

On 19 Aug 2008, brahmaforces[at]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

--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Aug 18, 2008, 11:54 PM

Post #4 of 9 (410 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

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
--
http://mail.python.org/mailman/listinfo/python-list


brahmaforces at gmail

Aug 19, 2008, 12:48 AM

Post #5 of 9 (403 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

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.de> wrote:
> 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

--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Aug 19, 2008, 1:46 AM

Post #6 of 9 (402 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

> 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
--
http://mail.python.org/mailman/listinfo/python-list


brahmaforces at gmail

Aug 20, 2008, 4:05 AM

Post #7 of 9 (373 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

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.de> wrote:
> > 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

--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Aug 20, 2008, 4:27 AM

Post #8 of 9 (381 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

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-like-image-resizing-using-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
--
http://mail.python.org/mailman/listinfo/python-list


brahmaforces at gmail

Aug 21, 2008, 3:56 AM

Post #9 of 9 (372 views)
Permalink
Re: Python Substitute for PHP GD, Resizing an image on the client side [In reply to]

Thanks for your help Diez appreciate it!

arjuna
http://www.brahmaforces.com
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.