Invalid Image Error Solved

atlantis

Joined: 2003-07-03
Posts: 12
Posted: Thu, 2003-07-03 20:01

I would get an "Inavlid Image" error on some of the images I was trying to upload using ImageMagick. Debug mode didn't help.

I finally found the problem. Apparently the UPLOAD_MAX_FILESIZE value in my php.ini file was set at 2M. I changed it to 6M and now I can upload my images (and movies).

c:\winnt\php.ini

; Maximum allowed size for uploaded files.
upload_max_filesize = 6M

----

Gallery version: 1.3.3
Web Server: Microsoft IIS
IIS version: 5.0
PHP version: 4.3.1
Graphics Toolkit: ImageMagick 5.5.6 Q16
Operating system: Windows 2000 Server
Web browser/version (if applicable): IE 6.0 SP1

Login or register to post comments
profgaw
profgaw's picture

Joined: 2004-02-04
Posts: 4
Posted: Fri, 2004-02-06 22:27

any idea of the command to do this for UNIX?

I can't seem to find the php.ini file, is it hidden?

Login or register to post comments
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8186
Posted: Fri, 2004-02-06 22:33

setup/phpinfo.php (when Gallery is in config mode) will show you where it is.

Login or register to post comments
atlantis

Joined: 2003-07-03
Posts: 12
Posted: Fri, 2004-02-06 22:44

From http://www.php.net/manual/en/faq.installation.php#faq.installation.phpini

By default on Unix it should be in /usr/local/lib which is <install-path>/lib. Howver, most people will change this at compile-time. Another common place to check is /etc/php.ini.

-*-

This may also help:

pettijhn at uiuc dot edu
07-Nov-2003 12:23
http://www.php.net/manual/en/configuration.php#configuration.file

"After setting a bunch of variables trying to fix a file upload error (files over a certain size resulted in the connection dying), I learned that in /etc/httpd/conf.d/php.conf there is a line LimitRequestBody 524288. Comment that out, restart apache."[/url]

Login or register to post comments
wpruchni

Joined: 2004-09-28
Posts: 1
Posted: Tue, 2004-09-28 19:00

/usr/local/php5/lib

There are other php.ini files, but changing them does not affect the server's behavior.

Refer to this FAQ for more information:
FAQ Gallery:c.6

Login or register to post comments
jeff9329

Joined: 2005-12-27
Posts: 3
Posted: Thu, 2005-12-29 13:38

FYI

php.ini is not visible or changable for people being hosted on a shared server.

Call your web host and they may change it from the default value (2M) to 8M so it will be at least equal your max_post value.

Jeff

Login or register to post comments
themafia69

Joined: 2006-02-28
Posts: 36
Posted: Sun, 2006-04-02 02:15

question, i asked netfirms to change the php.ini file they said they cant do that now, so is there any other way i can get around this?

Login or register to post comments
jeffkiss

Joined: 2007-03-08
Posts: 1
Posted: Thu, 2007-03-08 17:00

I read all of the posts but still couldn't get over the 2MB problem. On my Startlogic server they have the php.ini file located in /usr/local/lib/php.ini set to:
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Since I doubted that they would change it I looked for other ways. For Gallery2 I installed the data folder with the default name of g2data in my home directory not accessible from the web. I tried adding a php.ini in the gallery2 and g2data directories with the following but it did not eliminate the >2MB upload problem:

post_max_size = 12M
upload_max_filesize = 12M

I also tried modifying the .htaccess file in the g2data directory since that is the only location where that file existed by adding following:

php_value post_max_size 80000000
php_value upload_max_filesize 80000000

but that did not work either.

*** The SOLUTION that did work for me ***:
Create another .htaccess in the gallery2 folder.. the one that is accessible from the web located in your public_html directory and put the following in the file for up to 80MB post and upload capability:

php_value post_max_size 80000000
php_value upload_max_filesize 80000000
php_value magic_quotes_gpc off

Login or register to post comments
wileE

Joined: 2007-07-06
Posts: 1
Posted: Fri, 2007-07-06 14:34

I just wanted to add my findings:

I did all of the above, but was still having problems. It turns out, two things were wrong:

1. php overrides were not turned on (settings in .htaccess were being ingored)
2. there was a php.ini file and a php4.ini file. The php4.ini file was the one being used and limiting my uploads to 2M. Changed it to 64M and it worked just fine.

Login or register to post comments
bkinstle

Joined: 2008-04-08
Posts: 1
Posted: Tue, 2008-04-08 06:28

I've been fighting this problem for years and I finally figured it out. I'm running MacOSX Server 10.4.x and the problem was in the file at /etc/php.ini.default and all I had to do is change the following line:

upload_max_filesize = 2M

to

upload_max_filesize = 20M

I still can't get it to allow .htaccess files, but at least I can upload large photos now. Woot!

--
Bobby Kinstle

Login or register to post comments