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

Image manipulation in js

P: n/a
I dont know, and i dont much like javascript, however, i am told that
the only way to do want i want to do, is with javascript, so here goes.

zoom and cut is the only features i need.

1. the image that need manipulating is places on the server. dont need
js for that ;-)
2. the client has the oppotunity to manipulate the image. cut and zoom.
3. the image i saved on the server.

It sound realy simple, but than again, i know nothing of js ;-)

Hope to get the help i need.
Regards

Jun 11 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a

za******@gmail.com wrote:
I dont know, and i dont much like javascript, however, i am told that
the only way to do want i want to do, is with javascript, so here goes.

zoom and cut is the only features i need.

1. the image that need manipulating is places on the server. dont need
js for that ;-)
2. the client has the oppotunity to manipulate the image. cut and zoom.
3. the image i saved on the server.

It sound realy simple, but than again, i know nothing of js ;-)

Hope to get the help i need.


Not sure if I understand what you mean? Are you talking about a web
page which lets you zoom into an area of a photograph and then crop it
to size?

The problem with this is that as far as I know, you can't do image
manipulation like this in javascript - it simply doesn't have the right
commands to do it. What you could do is this:

- have the server generate a page with an image embedded in it.
- use javascript to zoom into the image using it's height and width
properties. I.e. you don't manipulate the image itself, just change the
way it's displayed so it /looks/ like it's been cropped or zoomed.
- then send back to the server the details of what you want doing to
it.
- then the server does the actual image manipulation using a server
side scripting language like perl or php and a graphics toolkit like
ImageMagick.

I.e. you use javascript to give the illusion of having really cropped
the image, but the actual work of doing this is done on the server.

hope this helps,

andy baxter

Jun 11 '06 #2

P: n/a
za******@gmail.com wrote:
I dont know, and i dont much like javascript, however, i am told that
the only way to do want i want to do, is with javascript, so here goes.

zoom and cut is the only features i need.

1. the image that need manipulating is places on the server. dont need
js for that ;-)
2. the client has the oppotunity to manipulate the image. cut and zoom.
3. the image i saved on the server.

It sound realy simple, but than again, i know nothing of js ;-)

Hope to get the help i need.
Regards


Hello,

If your project is for intranet and if you can control the
browser people are using, you may have a look at the new
"canvas" element. This is a WHATWG specification
[http://www.whatwg.org/specs/web-apps.../#scs-dynamic]

And it is supported by Firefox / Safari / Opera : all modern
browsers except IE.

This element enabled you to draw with javascript : Cut /
rotate / move an image and save it as PNG : (with the
toDataURL() method)

You can find some help here
:[http://developer.mozilla.org/en/docs...s_with_Canvas]
Just forget it if your audience is the whole Web : It's
always a bad thing the restrict accessibility of a web site.

Raphael
Jun 11 '06 #3

P: n/a

Raphael Jolivet wrote:
za******@gmail.com wrote:
I dont know, and i dont much like javascript, however, i am told that
the only way to do want i want to do, is with javascript, so here goes.

zoom and cut is the only features i need.

1. the image that need manipulating is places on the server. dont need
js for that ;-)
2. the client has the oppotunity to manipulate the image. cut and zoom.
3. the image i saved on the server.

It sound realy simple, but than again, i know nothing of js ;-)


This may help you
http://dhtmlgoodies.com/index.html?w...ipt=image-crop

Chris

Jun 11 '06 #4

P: n/a
> zoom and cut is the only features i need.

Zooming:
Just set its width and/or height attribute of image.
<img src="??" width="500" height="200" />

Cropping:
Use a DIV and IMG.
<div style="position:relative;width:[width]px;height:[height]px;">
<img src="??" style="position:relative;top:-[top offset]px;
left:-[left offset]px" />
</div>

Hope this helps,
the DtTvB

Jun 11 '06 #5

P: n/a

lo*****@fastmail.fm skrev:
za******@gmail.com wrote:
I dont know, and i dont much like javascript, however, i am told that
the only way to do want i want to do, is with javascript, so here goes.

zoom and cut is the only features i need.

1. the image that need manipulating is places on the server. dont need
js for that ;-)
2. the client has the oppotunity to manipulate the image. cut and zoom.
3. the image i saved on the server.

It sound realy simple, but than again, i know nothing of js ;-)

Hope to get the help i need.
Not sure if I understand what you mean? Are you talking about a web
page which lets you zoom into an area of a photograph and then crop it
to size?


I think you got it right, but maybe i shoud outline the part of my
project, this is all about.
Avatar pictures is what its all about, the must have a fixed size of
150*200px.
Often people upload pictures that are this size, or do not contrain
proportions and the last issue it the real problem, i want to give the
client a tool to make do something about it.
I for one know how enoying it is having a picture you want to use, but
cant because its not the right size, this way i dont have to install
software and stuff to fix it, but you can do via your browser.
Serverside/Clientside, doesnt matter as long as it works in all the
popular browser: ie, ns, ff, etc.
The problem with this is that as far as I know, you can't do image
manipulation like this in javascript - it simply doesn't have the right
commands to do it. What you could do is this:

- have the server generate a page with an image embedded in it.
- use javascript to zoom into the image using it's height and width
properties. I.e. you don't manipulate the image itself, just change the
way it's displayed so it /looks/ like it's been cropped or zoomed.
- then send back to the server the details of what you want doing to
it.
- then the server does the actual image manipulation using a server
side scripting language like perl or php and a graphics toolkit like
ImageMagick.
I originally wanted it to be server side, but was told that it would be
too demanding or that it simply wasnt posible.
I.e. you use javascript to give the illusion of having really cropped
the image, but the actual work of doing this is done on the server.

Just to make sure we understand eachother.
When all is done i have an image the size of 150*200 lying on the
server, no ilusions here ;-)
hope this helps,

andy baxter


Jun 11 '06 #6

P: n/a
za******@gmail.com said the following on 6/11/2006 2:18 PM:

<snip>
Just to make sure we understand eachother.
When all is done i have an image the size of 150*200 lying on the
server, no ilusions here ;-)


What you need is software for the server that can crop the image for
you. Or, that can resize it. Either crop it or resize it (or both),
display them both to the user, let them pick which one they want with
the third option to resize it themselves.

In any event, the server is the best place for it to happen.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 11 '06 #7

P: n/a

za******@gmail.com wrote:
lo*****@fastmail.fm skrev:
this is that as far as I know, you can't do image
manipulation like this in javascript - it simply doesn't have the right
commands to do it. What you could do is this:

- have the server generate a page with an image embedded in it.
- use javascript to zoom into the image using it's height and width
properties. I.e. you don't manipulate the image itself, just change the
way it's displayed so it /looks/ like it's been cropped or zoomed.
- then send back to the server the details of what you want doing to
it.
- then the server does the actual image manipulation using a server
side scripting language like perl or php and a graphics toolkit like
ImageMagick.

I originally wanted it to be server side, but was told that it would be
too demanding or that it simply wasnt posible.


Have a look at ImageMagick - there's a perl api for this which works OK
(Image::Magick). Whether it's possible depends on who's running your
server I guess.
I.e. you use javascript to give the illusion of having really cropped
the image, but the actual work of doing this is done on the server.


Just to make sure we understand eachother.
When all is done i have an image the size of 150*200 lying on the
server, no ilusions here ;-)


Yes - you use client side scripting to display a cropped, resized image
in a box on the screen, but you're only doing this by manipulating the
stylesheet parameters, not actually cropping the image. Then you send
the parameters back to the server for it to do the real crop/resize
there.

Jun 11 '06 #8

P: n/a

lo*****@fastmail.fm wrote:
za******@gmail.com wrote:
lo*****@fastmail.fm skrev:
this is that as far as I know, you can't do image
manipulation like this in javascript - it simply doesn't have the right
commands to do it. What you could do is this:

- have the server generate a page with an image embedded in it.
- use javascript to zoom into the image using it's height and width
properties. I.e. you don't manipulate the image itself, just change the
way it's displayed so it /looks/ like it's been cropped or zoomed.
- then send back to the server the details of what you want doing to
it.
- then the server does the actual image manipulation using a server
side scripting language like perl or php and a graphics toolkit like
ImageMagick.

I originally wanted it to be server side, but was told that it would be
too demanding or that it simply wasnt posible.


Have a look at ImageMagick - there's a perl api for this which works OK
(Image::Magick). Whether it's possible depends on who's running your
server I guess.
I.e. you use javascript to give the illusion of having really cropped
the image, but the actual work of doing this is done on the server.


Just to make sure we understand eachother.
When all is done i have an image the size of 150*200 lying on the
server, no ilusions here ;-)


Yes - you use client side scripting to display a cropped, resized image
in a box on the screen, but you're only doing this by manipulating the
stylesheet parameters, not actually cropping the image. Then you send
the parameters back to the server for it to do the real crop/resize
there.


I was thinking, if you can't do stuff on the server because of
performance issues, you might be able to do it in a java (not
javascript) applet on the page, and use your client's cpu to do the
image rendering. This would be a lot of work though.

Jun 11 '06 #9

P: n/a

lo*****@fastmail.fm skrev:
lo*****@fastmail.fm wrote:
za******@gmail.com wrote:
lo*****@fastmail.fm skrev:

> this is that as far as I know, you can't do image
> manipulation like this in javascript - it simply doesn't have the right
> commands to do it. What you could do is this:
>
> - have the server generate a page with an image embedded in it.
> - use javascript to zoom into the image using it's height and width
> properties. I.e. you don't manipulate the image itself, just change the
> way it's displayed so it /looks/ like it's been cropped or zoomed.
> - then send back to the server the details of what you want doing to
> it.
> - then the server does the actual image manipulation using a server
> side scripting language like perl or php and a graphics toolkit like
> ImageMagick.
>
I originally wanted it to be server side, but was told that it would be
too demanding or that it simply wasnt posible.


Have a look at ImageMagick - there's a perl api for this which works OK
(Image::Magick). Whether it's possible depends on who's running your
server I guess.
> I.e. you use javascript to give the illusion of having really cropped
> the image, but the actual work of doing this is done on the server.
>

Just to make sure we understand eachother.
When all is done i have an image the size of 150*200 lying on the
server, no ilusions here ;-)


Yes - you use client side scripting to display a cropped, resized image
in a box on the screen, but you're only doing this by manipulating the
stylesheet parameters, not actually cropping the image. Then you send
the parameters back to the server for it to do the real crop/resize
there.


I was thinking, if you can't do stuff on the server because of
performance issues, you might be able to do it in a java (not
javascript) applet on the page, and use your client's cpu to do the
image rendering. This would be a lot of work though.


Client Java? no, no and no again...
Not that it isnt a good idea, but i have often experienced enouing
stuff with jave. either you havent installed it or it needs update,
etc. and it is important for me to spare the users on my site for this.

Jun 12 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.