Saurabh
Saurabh

Reputation: 148

Rotate big size image gives error in php

When I am rotating small images by rotateImage() function then its working fine.But in case large file (5500 X 3000px) it gives error. How we handle large images in php.

// Content type
header('Content-type: image/jpeg');
// Load
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
imagejpeg($rotate,'new.jpg');

When we rotate image its memory size and dimensions increased gives and it gives out of memory error.I want to rotate image similar photo-shop rotate operation every thing is same as original image.

Upvotes: 0

Views: 693

Answers (1)

Levi Morrison
Levi Morrison

Reputation: 19552

My guess is that you are running out of memory if it works on small images but not large ones. If this is the case you can increase the memory limit in php.ini with memory_limit .

You should also run through your script and make sure you are not copying things unnecessarily. Try to do in-place modification.

Upvotes: 1

Related Questions