M
M
mishael2011-09-30 14:27:01
HTML
mishael, 2011-09-30 14:27:01

Image resizing on HTML5 client?

IE5 is going to disable Flash, saying that everything can be implemented in HTML5. Is it possible to resize and rotate images on HTML5 on the client Before uploading to the server? Flash can and I use it.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
G
Grigory Peretyaka, 2011-09-30
@Peretyaka

How to access an unloaded image from javascript using FileAPI there are many articles, including those on Habré
As far as I know, FileAPI does not allow image processing. Thus, you will have to create canvas yourself, add an image to it, process it there, upload it again in text form and send this result to the server.
Together, I did not do this and did not find that someone would describe a similar process and possible difficulties, but individually everything is described a hundred times and I think there will not be any special problems.
Materials:
HTML5 File API
HTML5 CANVAS step by step: images

K
korvindest, 2011-09-30
@korvindest

Whatever is similar ?

M
mark_ablov, 2011-09-30
@mark_ablov

Difficult, but possible.
The FileAPI allows you to work with raw data.

M
Maxmyd, 2011-09-30
@Maxmyd

Any image, before appearing in the browser, must first appear on the server. HTML5 Canvas works great with pictures, but it also doesn't know anything about what picture is on your computer. It needs to be downloaded. The same FileReader in the FileAPI asynchronously loads the file, and does not read its content before downloading.
Alas, the client script is denied access to the local file system.

M
Masterkey, 2011-09-30
@Masterkey

Even if you have access to the File API in all browsers and still rewrite resize / rotate images for 3 types of images in JS, then it will be terribly stupid on large images.
According to KISS, it's better to send them to the server and change them there.
In addition, even if ie10 declared the absence of a flash, this does not mean that clients will listen to him like that, they will either install a flash or go to another browser.
Take a wait-and-see attitude now, and when you have ~ 3% of users with such a problem, then start discussing who is to blame and what to do

M
mishael, 2011-10-01
@mishael

Sending to the server for compression is not an option. A man came from a hike - he has 200 photos of 5 megabytes. sending a gig to the Internet is slow even with today's Internet for a lot of people. Therefore, it is necessary to pinch BEFORE sending.

K
Kane, 2011-10-01
@Kane

Yes, it's possible using FileAPI + canvas. Take a look at this library www.pixastic.com/lib/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question