forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 upload => Topic started by: Mate Matic on December 05, 2014, 12:12:50 pm

Title: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 05, 2014, 12:12:50 pm
Until last week it was no problem to add new pictures to my coppermine albums.
But since monday I get errors.
Now, I followed the steps of the troubleshooting guide:
http://documentation.coppermine-gallery.net/en/upload_troubleshooting.htm (http://documentation.coppermine-gallery.net/en/upload_troubleshooting.htm)

and I get the following error message:

Code: [Select]
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24848 bytes) in /var/www/vhosts/web690.c1.webspace-verkauf.de/html/coppermine/include/picmgmt.inc.php on line 437
Is the upload problem caused by my web hosting provider?
Or is it an configuration problem of my coppermine settings?
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 05, 2014, 12:54:50 pm
 Fatal error: Allowed memory size of X bytes exhausted: http://forum.coppermine-gallery.net/index.php/topic,76445.0.html (http://forum.coppermine-gallery.net/index.php/topic,76445.0.html)

upload erorr when I upload big images: http://forum.coppermine-gallery.net/index.php/topic,75099.0.html (http://forum.coppermine-gallery.net/index.php/topic,75099.0.html)

I had the same problem when I was at Yahoo host. They have a limit.

Please use search before asking a question :)
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 05, 2014, 02:34:00 pm
I forgot.
Maybe you have access to php.ini on your host to change the memory limit.
Look in your host Cpanel or contact you host.
You can even ask them if you have limits.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 06, 2014, 02:49:55 am
No, my web hosting contact wrote, the the upload_max_filesize ist limited to 64 MB.
So, why does it not work by loading the pictures into the database?
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 06, 2014, 03:52:37 am
Your error talks about memory limit. In the firts link I posted in reply#1 I talk about memory limit.
Memory limit is important. You can have upload_max_filesize limited to 64 MB, but if the memory limit is something like 64M, then you will get that error.

Do you have access to php.ini on your host? Should be in your Cpanel. Most host allow to edit php.ini.
Yahoo host did not.
php.ini has the memory limit settings, upload_max_filesize etc.

If not then create a new file in your gallery folder. Name it phpinfo.php.
Open it and paste this code:

Code: [Select]
<?php phpinfo(); ?>

Save it.

In your browser (firefox, chrome etc) type your_gallery_adress/phpinfo.php

This will show you all your php settings. No need to contact the host again. See attachmennt phpinfo1.jpg.
Look for memory limit (see attachment phpinfo2.jpg).

Please tell me the values. In my screenshot is 150M.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 06, 2014, 10:46:23 am
Thanks a lot for your help with my investigations.

There is already a phpinfo.php file in my gallery folder on the web server.
Shown PHP Version 5.3.28. And here are the other results:

Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 06, 2014, 01:21:03 pm
Let's translate your error: allowed memory size of 134217728 bytes exhausted (tried to allocate 24848 bytes) = allowed memory size of 128M exhausted (tried to allocate 0.023696899M ). You can use a converter from bytes to mebibyte. Type bytes in mb in Google Serach and should show google converter (see attachment). From the dropdown menu choose bytes and mebibyte (M). Megabyte is MB.

Your error says that you exhausted the 128M memory limit you have. For that image you uploaded when you got that error you need other 0.023696899M. For that image 128M memory limit was not enough. For every image the error will tell you how much you still need.

You can insist to find a solution, but even the coppermine docs says that this error is about the memory limit. It can not be something else. Is nothing you can do.

You did not answer one of my questions: Do you have access to php.ini on your host?
You have to edit php.ini. In phpinfo.php file find Loaded Configuration File that shows you where is php.ini in your file manager, but you should have PHP Setting in your Cpanel somewhere to find it easier. Ask the host if you can edit php.ini if you don't find it.

If your host restricts their users to edit php.ini then ask them to increase at 150M.
On my localhost (I installed php and server on PC) I have 150M.
On my host I have by default 200M. I never have to edit it, but I am allowed to edit it.

If you can't edit php.ini and the host won't do it for you, then the only way is this:
http://forum.coppermine-gallery.net/index.php/topic,76445.0.html (http://forum.coppermine-gallery.net/index.php/topic,76445.0.html) but may not work on your host.

Another way is to make the image smaller with a photo editor, then use filezilla to overwrite the image on the server with the big image. Then you have to use coppermine Admin Tools to update thumbs (when you hove over the thumb will show the size of the image you uploaded with coppermine upload. need to update after overwrite to refresh image size ) .
If you have users then that's a problem. Only you can accesss the server with FileZilla.

I'm sorry but is no other way around it when you have this error. I'm sure of that.

Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 06, 2014, 01:49:53 pm
Another way is to always optimize you images with a photo editor (ex: photoshop has option Save for web to reduce image size, not image resolution, without loosing quality). Adobe photoshop is not free.  Gimp is one of the free editors I know that's similar to photoshop.
Ex: From 1.5MB to 800kb.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 06, 2014, 02:01:05 pm
If your host does not allows editing php.ini, then they proabibly do not allow .htaccess for hotlinking and other things that in time you will need.
Better to change host soon before you have a bigger gallery.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 06, 2014, 02:46:46 pm
The error points to coppermine/include/picmgmt.inc.php on line 437 because there is the code to create images on upload "$src_img = imagecreatefromjpeg($src_file);"  or line 439 "$src_img = imagecreatefrompng($src_file);"  that can not execute because he needs you to allocate him more memory (increase php memory limit in php.ini). I assume he points to another line in some cases depending on your coppermine settings. What I am trying to say is that even if the error shows picmgmt.inc.php it does not means is an error there. Is not a coppermine error.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 06, 2014, 04:03:03 pm
You did not answer one of my questions: Do you have access to php.ini on your host?

Sorry, I was a bit tired today in the morning. So I forgot to answer.
I was asking my web hosting provider, if I can raise the memory limit to 150M, but didn't get an answer so far.

The mentioned php.ini file ist located here on the web server:
/usr/local/php5328-cgi/etc
Unfortunately I can't access this folder.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 08, 2014, 10:24:57 am
My web hosting provider says again, they allow only an upload_max_filesize of 64M (converted about 67 MB).

They don't lose a word if the error is caused by the value memory_limit of 128M (about 134 MB) in the php.ini.

But I think, even 64M should be enough to handle a picture with a size of about 12 MB in the file system. Or is the real size much bigger and I cannot see this?
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 08, 2014, 11:08:56 am
Now, I set the Maximum size for file upload (Maximalgröße für das Hochladen von Dateien) of 134217 KB in coppermine and chose the option Automatically resize pictures which exceed this file size (Automatische Verkleinerung von Bildern, die die Maximalgröße überschreiten): Yes, all (user + admin).
But it still doesn't work.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 08, 2014, 02:34:45 pm
Now, I set the Maximum size for file upload (Maximalgröße für das Hochladen von Dateien) of 134217 KB in coppermine and chose the option Automatically resize pictures which exceed this file size (Automatische Verkleinerung von Bildern, die die Maximalgröße überschreiten): Yes, all (user + admin).
But it still doesn't work.

Automatically resize pictures which exceed this file size DOES NOT EXIST in coppermine config.
Is Auto resize images that are larger than max width or height

See attachment
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 08, 2014, 02:56:38 pm
My web hosting provider says again, they allow only an upload_max_filesize of 64M (converted about 67 MB).

With 134217 KB = 128M in Config - Max size for uploaded files you past over upload_max_filesize of 64M, but is not important. Images are usually smaller then 64M.

They don't lose a word if the error is caused by the value memory_limit of 128M (about 134 MB) in the php.ini.

You don't need to ask them if is caused by memory limit. They don't want to talk about it and you should of ask them if you can edit it or if they can edit it.
In reply#6 I translate your error. Every image that will give you "Fatal error: Allowed memory size of..." will tell you how much it still needs. I'M SURE IS THE MEMORY LIMIT

But I think, even 64M should be enough to handle a picture with a size of about 12 MB in the file system. Or is the real size much bigger and I cannot see this?

upload_max_filesize is how big a file can be.
memory_limit is how much server memory will use to upload or resize a file (image, video etc).
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 08, 2014, 03:17:25 pm
Now, I followed the steps of the troubleshooting guide:
http://documentation.coppermine-gallery.net/en/upload_troubleshooting.htm (http://documentation.coppermine-gallery.net/en/upload_troubleshooting.htm)

Did you tryed changing GD to ImageMagick. I think Image Magick consumes less memory on resize. GD and ImageMagick are for resizing only ( create thumbnails, Create intermediate pictures and Auto resize images that are larger than max width or height ). Will proabibly help.
I think Image Magick makes lower quality images.

See attachment.

Quote from my first reply that you ignored:
Fatal error: Allowed memory size of X bytes exhausted: http://forum.coppermine-gallery.net/index.php/topic,76445.0.html (http://forum.coppermine-gallery.net/index.php/topic,76445.0.html)

Please try this to overwrite your server memory limit from 128M to 150M (use 200 or more if is still not working).

In phpinfo.php will still show 128M, but will actually trick the server and use 150M.

PLEASE TRY to read all my replies  and apply all my solutions.
If you will try it and will work then you will be sure the problem is the memory limit.
Let's hope your host can be tricked.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 08, 2014, 03:52:48 pm
You shoud have in yuor control panel PHP configuration or  PHP Settings or something like this.
Depends what kind of control panel your host installed. Just click all the tools, buttons etc  until you find it.


Demo CPanel X with PHP configuration tool: http://x3demob.cpx3demo.com:2082/cpsess150110528/frontend/x3/index.html?post_login=59609434646239 (http://x3demob.cpx3demo.com:2082/cpsess150110528/frontend/x3/index.html?post_login=59609434646239). Clicking on PHP settings takes you to: http://x3demob.cpx3demo.com:2082/cpsess150110528/frontend/x3/php/index.html?lang (http://x3demob.cpx3demo.com:2082/cpsess150110528/frontend/x3/php/index.html?lang)  or see attachments.

In the demo the memory limit is not editable, but on a host, you can change the values.

I have a diffrent one with PHP Settings tool: see attachment.

I'm sure you don't have that. Your host would of told you to go and edit it yourself.

or in File Manager folder home/your_user_name/ or something like this.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: phill104 on December 08, 2014, 06:22:27 pm
Let's go back to basics first. Please setup a user account that we can test uploads to and also set single file uploads as outlined in the docs. Once you have that setup please post a link to your site including the logon details for the user account but test it first logged on as that user to make sure all permissions are correctly set. It will allow us to check a few things before we get in too deep in server side problems, just to make sure.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: Mate Matic on December 09, 2014, 08:53:33 am
Automatically resize pictures which exceed this file size DOES NOT EXIST in coppermine config.
Is Auto resize images that are larger than max width or height

Ah, I've mixed it up. Thanks for your hint.


Did you tryed changing GD to ImageMagick.

Yes, I did. It works after my web hosting provider activated Image Magick in the server's PHP settings.
But I needed to ask him to do this before.
This solved my problem.
Bow, big pictures will be resized and the upload process in coppermine works fine.

allvip, thank you so much for your helping approaches.
Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 09, 2014, 12:01:43 pm
It work fine now because ImageMagick is not limited by PHP memory limit but creats much bigger file size that uses much more server resourses. See attachment from Reply #13 to see where in Config is GD and ImageMagick.

GD: uses less server resources , lower file size, lower image quality but is limited by PHP memory_limit.
ImageMagick:  uses more server resources, much bigger file size (double), better image quality and is not limited by PHP memory_limit.

Read here: Advantages: ImageMagick versus GD :   http://forum.coppermine-gallery.net/index.php?topic=34098.0 (http://forum.coppermine-gallery.net/index.php?topic=34098.0)

ImageMagick vs GD vs Photoshop (quality and size): https://foliovision.com/2010/03/imagemagick-vs-gd (https://foliovision.com/2010/03/imagemagick-vs-gd)
Photoshop is a photo editor.

With ImageMagic you will have bigger file size even for thumbnails wich will use more the server resources.
Server resources: CPU time and MySql time. They are very,very important on every server not just on shared server (host). The host can say that you gallery is too big and buy a bigger plan.
Every time your users load (view) pages with an image (images for the thumbnails page), the bigger the images are, the more CPU and MySql time is using.
On my shared host CPU time is limited to 100 minutes and MySql time is limited to 20 minutes.
Also on my host control panel I have the Resources button (tool) that shows be how much cpu and mySql time I use every day. This way I can check if I past the limits.

Conclusion:
1) Better to have smaller file size for intermediate image and thumbnails. The image quality is not important.
2)  For the uploaded image the quality is important. The real uploaded image (that shows in pop up when you click the image) will not be resized so it won't loose quality .Wil be resized (so will loose quality) only if is bigger then Max width and height for uploaded images set in coppermine config.
3) If you have many visitors you will have high CPU and MySql time.
4) Better to us GD and have more PHP memory limit so please use the firts link in reply#1.


PLEASE, 1000 please try the fix from the first link in reply#1 and GD. Even if ImageMagick is OK for you, I just want to know if it works for you to make your PHP memory limit bigger.

Title: Re: No further photos can be added to an album - batch add and http upload fails
Post by: allvip on December 09, 2014, 01:01:53 pm
You can compare the file size.
Use GD and save in your PC just one image (original, intermediate and thumb), then use Image Magick and save the same image in you PC.
Compare them and see if it is a big diffrence.

Topics you may need: 

Small database ( make you database smaller) for less server resource: http://forum.coppermine-gallery.net/index.php/topic,77935.0.html (http://forum.coppermine-gallery.net/index.php/topic,77935.0.html)

Hotlinking to redirect to the page that contains the image (more visitors to your gallery) : http://forum.coppermine-gallery.net/index.php/topic,76683.0.html (http://forum.coppermine-gallery.net/index.php/topic,76683.0.html)