davy_yg's avatar
Level 27

Unable to save image using summernote

After uploading an image file using summernote and save it I get this error message:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 51957760 bytes)

Any idea why?

0 likes
2 replies
LaryAI's avatar
Level 58

The error message you're encountering indicates that your PHP script is trying to use more memory than is allowed by the server's configuration. This is a common issue when dealing with large files or images. Here are a few steps you can take to resolve this:

  1. Increase PHP Memory Limit:

    You can increase the memory limit in your php.ini file. Look for the line that sets memory_limit and increase its value. For example:

    memory_limit = 256M
    

    If you don't have access to php.ini, you can try setting it in your script using:

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

    Or in your .htaccess file:

    php_value memory_limit 256M
    
  2. Optimize Image Handling:

    If increasing the memory limit is not an option or doesn't solve the problem, consider optimizing how you handle images:

    • Resize Images: Resize images before uploading them to reduce their size.
    • Use Image Libraries: Use libraries like GD or Imagick to process images more efficiently.
  3. Check for Infinite Loops or Large Data Structures:

    Ensure that your code doesn't have any infinite loops or is not trying to load large data structures into memory unnecessarily.

  4. Server Configuration:

    If you're on a shared hosting environment, you might need to contact your hosting provider to increase the memory limit.

  5. Debugging:

    If the problem persists, try logging the memory usage at different points in your script to identify where the memory is being exhausted.

By following these steps, you should be able to resolve the memory exhaustion issue when saving images using Summernote.

Sinnbeck's avatar

On line 32 you have a function that calls itself :p

Or rather.. its impossible to tell without seeing any code

1 like

Please or to participate in this conversation.