Jump to content

Allowed memory size of 134217728 error when uploading Image


Recommended Posts

Hi,

From admin panel I changed the maximum size of image upload to 5mb.

Now when uploading image I get following error:

26-Sep-2015 20:14:29 US/Central] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 11952 bytes) in /home/…………………………………Uploader.php on line 270
/**
     *
     * rotate uploaded image automatically based on exif orientation
     *
     * @param string $fileName
     *
     * @return $this
     */
    protected function _imageSmartRotate($fileName)
    {
        $output = null;

        if (function_exists('exif_read_data')) {
            $exif = @exif_read_data($fileName);
            if (!empty($exif['Orientation'])) {
                $image = $this->_imageCreateFunction($fileName);

                switch ($exif['Orientation']) {
                    case 3:
                        $output = imagerotate($image, 180, 255);
                        break;
                    case 6:
                        $output = imagerotate($image, -90, 255);
                        break;
                    case 8:
                        $output = imagerotate($image, 90, 255);
                        break;
                }

                if ($output !== null) {
                    touch($fileName);
                    imagepng($output, $fileName);
                    imagedestroy($output);
                }
            }
        }

        return $this;
    }

    /**
     *
     * add watermark to the image that has been uploaded
     *
     * @param $fileName
     * @param $watermarkText
     *
     * @return $this
     */

The line 270 error is this one under Case 6 bold.

case 6:
$output = imagerotate($image, -90, 255);
break;

 

Anyone know what is the problem. 

Need to raise your memory limit in the working php.ini file or set it top of the script.

 

Not sure how much memory you have available.

php.ini

memory_limit = 256M

 

top of script

ini_set('memory_limit', '256M');

if not what you needed try change in php.ini

 

No, this doesn't have anything to do with the maximum upload size, it's a memory problem.

 

If at all, you'd decrease the maximum filesize so that image manipulation takes less memory. Increasing it to 128M would be counter-productive, because then you definitely exceed the memory limit and fill up your hard drive.

My Maximum size allowed is: 1000000KB. 

What size should I set.

Also max uploaded limit in your php.ini file is set 1000MB as I use the same server for my video website and I upload more than 700MB video files and successful without error but that a different website but same server. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.