Question

I'm using Jcrop to crop and upload image. I'm using this tutorial and source code to develop my system

html5-image-uploader-with-jcrop

Now it can't handle images that are more than 250 KB. It gives an error as

You have selected too big file, please select a one smaller image file

So I tried to change the script.js. On the fileSelectHandler method, I tried to change this line

if (oFile.size > 250* 1024)

with

if (oFile.size > 2048 * 2048)

But it didn't work. I can't find any other option to change. Can anyone please tell me what I'm missing? How can I withdraw this size restrictions? I want to handle 2mb size image or at least of (1024*1024) pixels size image. Please help......

Was it helpful?

Solution

1st changed the upload.php file. A line from

if (! $_FILES['image_file']['error'] && $_FILES['image_file']['size'] < 250 * 1024)

to

if (! $_FILES['image_file']['error'] && $_FILES['image_file']['size'] < 2048* 2048)

As I mentioned in the question, changed script.js. A line from

if (oFile.size > 250* 1024)

to

if (oFile.size > 2048 * 2048)

And lastly to be able to save the image in the cropping size rather not in some pre-defined size, I added an extra line of

$iHeight=(int)$_POST['h']; $iWidth=(int)$_POST['w'];

before this line

$vDstImg = @imagecreatetruecolor( $iWidth, $iHeight );

Then the image will be saved in exact same size as cropped in preview.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top