473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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?
Aug 19 '08 #1
8 2599
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
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
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
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
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
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
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
Thanks for your help Diez appreciate it!

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

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

Similar topics

14
by: Tim Parkin | last post by:
Terry Ready said: > YUCK< YUCK< YUCK. > <snip> > The pollenation site is one of the worst I have seen. The mockup page > has teeny type that IE will not enlarge. > <snip> > I care that the...
7
by: Ingo Linkweiler | last post by:
Hello, I am looking for a 100% python lib/script which can load a jpg image, detect its size, resize and save it as new file. I have found some tools (like PIL), but all of them use ImageMagic...
16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
2
by: vunet.us | last post by:
I have been using Imager Resizer (http://www.crazybeavers.se/products_imagerresizer.asp) DLL component to handle all my image resizing on server side and delivering a custom-size image to the...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
10
by: Keith G Hicks | last post by:
I'm hoping there's a simple way to do this. I need to show a dummy image in an asp image object if the file is missing. Here's my asp.net 2.0 markup: <asp:Image ID="imgGrad" runat="server"...
32
by: C. (http://symcbean.blogspot.com/) | last post by:
Hi all, I have an application which generates image graphs. These cache nicely at the client, however if the user submits more data, I'd like to force a reload of the image from the server. I...
37
by: Michael Palmer | last post by:
As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come...
1
by: keksy | last post by:
Hi every1, I am writing a small client/server application and in it I want to send an image asynchronous from the client to the server through a TCP socket. I found an example code on the MSDN...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.