coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Upload => Topic started by: zzzib on June 14, 2004, 11:13:18 AM

Title: "Not a GD extension", but file is a GD extension.
Post by: zzzib on June 14, 2004, 11:13:18 AM
CPG 1.3.0
When I try to upload a small JPG file I face with:
Quote
0 uploads were successful.
Error Report
The following uploads encountered errors:    
File Uploads:    
File Name/URL   Error Message   
1. Flowers.JPG   Not a GD extension.
I looks like a problem from http://forum.coppermine-gallery.net/index.php?topic=6545.0
but I continue:
when I upload this photo via FTP to my site (http://maxilena.msk.ru/Flowers.JPG) and then select to upload from a URL location and write:
http://maxilena.msk.ru/Flowers.JPG
I got a SUCCESSFUL upload!
The same photo! :(
Please, would you be so generous to help me!
http://maxilena.msk.ru/forums/index.php?act=Login&CODE=00
login: Test
pass: test
P.S. Only forum is in russian, after logging in, go to
http://maxilena.msk.ru/gallery/index.php - it's in english
P.P.S. Using search gave me 38 pages, I looked through several of them, but did not found what I need...
Sorry for my english
Title: Re: Uploading problem
Post by: Casper on June 14, 2004, 11:50:22 AM
I tried and had the same problem with jpg files, also tried a png, and had a 'Pixel allowance exceeded', even though this is a known good pic of 30x170, which is smaller than the pics you have on your site.
I also noted that you have set the thumbnail size far too high.  Your thumbs should not be the same size as the full size pics.

It is possible this is causing the problem.  There are 2 thumbnail settings in config, try setting them both to 75, and see if that helps.

If not, try setting all groups can only add one pic at a time, and see if you can upload a jpg then.
Title: Re: Uploading problem
Post by: zzzib on June 14, 2004, 01:05:08 PM
I've made changes in config -> set both thumbernail settings to 75;
                                           set max number of pics to upload to "1";
Thumbernail size is now OK,
but the problem is still there :((((
I got a 'GD error' :(
Please, can you look on the config?
I've added to the Test user admin previlegies
Title: Re: Uploading problem
Post by: Casper on June 14, 2004, 02:34:54 PM
OK,

First please change test user back to a registered user, for your security.

I had a look, and there seems no reason it is not working.  Your php info was interesting though, as it showed 'GIF write support' enabled.  This may be the cause, if it causes conflict within upload.php.

Please try uploading by ftp, into a folder you make in albums, not in the userpics folder.  Then see if it works when you batch add.
Title: Re: Uploading problem
Post by: hyperion on June 14, 2004, 07:25:50 PM
This error would be caused by an issue with the built in PHP function getimagesize. Activate debug mode to see if you get a warning pertaining to this function.  If not, it may be returning a nonstandard response, and you would need to see what the response was by writing a small script to check an image with it.

Alternatively, this may be an issue with upload truncation of some sort, because we would expect the URL upload to fail if it the problem was with getimagesize.
Title: Re: Uploading problem
Post by: zzzib on June 14, 2004, 09:46:43 PM
Casper, batch adding was successful, I can't see the reason of not working...
Thanks for help!
hyperion, is there any already-done script for such a test?
That's it - batch adding and URL uploading successeeded, but just uploding fails :(
Title: Re: Uploading problem
Post by: zzzib on June 14, 2004, 09:52:38 PM
Quote from: hyperion on June 14, 2004, 07:25:50 PM
Activate debug mode to see if you get a warning pertaining to this function.
How does that warning looks like?
Title: Re: Uploading problem
Post by: m0nty on June 14, 2004, 10:14:54 PM
i had similar problems a while back, but that was due to my server host i think.. no matter what, it wouldn't let me upload an image larger than 1024x768 when using GD

i had to use netpbm or imagemagic to get round it...

just a thought..
Title: Re: Uploading problem
Post by: zzzib on June 15, 2004, 09:51:35 AM
Quote from: m0nty on June 14, 2004, 10:14:54 PM
i had similar problems a while back, but that was due to my server host i think.. no matter what, it wouldn't let me upload an image larger than 1024x768 when using GD

i had to use netpbm or imagemagic to get round it...

just a thought..
But I can't upload even a small image!.. :(
Title: Re: Uploading problem
Post by: hyperion on June 15, 2004, 10:22:31 AM
Run the following code on an image.  You'll need to set the image path. Try running it on a jpg, png, and gif.  Post the results here. 


<?php

$path_to_image 
'./example.jpg';

$image_information getimagesize($path_to_image);

print_r($image_information);

?>

Title: Re: Uploading problem
Post by: zzzib on June 15, 2004, 11:26:19 AM
Here they are:
jpg
Quote
Array (
  • => 320 [1] => 240 [2] => 2 [3] => width="320" height="240" [bits] => 8 [channels] => 3 )
png
Quote
Array (
  • => 300 [1] => 75 [2] => 3 [3] => width="300" height="75" )
gif
Quote
Array (
  • => 76 [1] => 16 [2] => 1 [3] => width="76" height="16" )
Title: Re: Uploading problem
Post by: zzzib on June 15, 2004, 08:14:43 PM
Casper, any else ideas? :-|
Title: Re: Uploading problem
Post by: Casper on June 15, 2004, 08:37:18 PM
If you did not do this, please try it.

Go into 'groups', and change the 'Upload form configuration' to 'single file uploads only, as in this pic.
Then try, and let us know.  If you have already done this, then I don't know.

[attachment deleted by admin]
Title: Re: Uploading problem
Post by: hyperion on June 16, 2004, 02:26:22 AM
If you still get a GD extension error message after trying Casper's advice, restore the upload configuration to 'File/URI'.  Then follow this procedure.

1. Edit upload.php on line 1228. Change @unlink($path_to_image); to //@unlink($path_to_image);. This will stop CPG from deleting the file so we may examine it.

2. Clear all files except for index.html from your albums/edit directory.

3. Click the 'Upload file' link in Coppermine.

4. Select a single file for upload.  Click 'Continue'.

5. Coppermine should give you the GD error message. Do not click 'Continue.'

6. Now look in the albums/edit direcotry.  You should see a single image file with a name like mHTTP_temp_8f16c261.jpg.

7. Place the script I gave you earlier into the /albums/edit directory, and make the path point to the image in this directory.

8. Run the script, and post the results here.

9. Restore your upload.php file to its original condition.

We are now trying to see if something happens to the image during upload that prevents getimagesize from working correctly.
Title: Re: Uploading problem
Post by: zzzib on June 16, 2004, 10:34:03 AM
Quote from: Casper on June 15, 2004, 08:37:18 PM
If you did not do this, please try it.

Go into 'groups', and change the 'Upload form configuration' to 'single file uploads only, as in this pic.
Then try, and let us know.  If you have already done this, then I don't know.
I've done everything as you said
the result:
Quote
Error
The file you have uploaded is not a valid image !

File: /home/mankind/www/site3/public_html/gallery/db_input.php - Line: 282

hyperion,
Test.php script doesn't show anything  - http://maxilena.msk.ru/gallery/albums/edit/Test.php
And I just can't see the image itself through a browser (but I see it via FTP): http://maxilena.msk.ru/gallery/albums/edit/mHTTP_temp_373f526f.JPG
Title: Re: Uploading problem
Post by: hyperion on June 16, 2004, 05:19:33 PM
Okay, this means that some sort of corruption is taking place during the upload. Try downloading the image from the /albums/edit directory through FTP, and then try to open it in photo editing software.  Please note anything unususal about the image here, such a an extremely small filesize, etc.
Title: Re: Uploading problem
Post by: zzzib on June 16, 2004, 07:22:08 PM
Quote from: hyperion on June 16, 2004, 05:19:33 PM
Okay, this means that some sort of corruption is taking place during the upload. Try downloading the image from the /albums/edit directory through FTP, and then try to open it in photo editing software.  Please note anything unususal about the image here, such a an extremely small filesize, etc.
It's 10,8 KB.
No information is available. Opening it brings to 'Can't display image'
Title: Re: Uploading problem
Post by: hyperion on June 17, 2004, 12:43:25 AM
Well, this may be as far as I can take you.

We know that something is happening to the file that corrupts it during the upload or during the transfer from the temporary directory.

This problem is caused by your server, and a Google search confirms that other people have had similar problems with PHP.

Some possible reasons:

1. Your version of PHP is buggy.
2. You are behind a proxy.
From php.faqts
Quote
When uploading binary files, some bytes are become corrupted, but file size isnt changing, why?
Jan 27th, 2000 16:39

Manuel Lemos, Nathan Wallace, Michael Berndt, Dmitry Jo

This is a known PHP bug that shows when a client send unexpected
headers in the upload HTTP request. See this report:

http://bugs.php.net/bugs.php3?id=2944

Manuel Lemos
---

The same thing happened to me when trying to do the file upload through
a Proxy.  Funnily enough, the Proxy puts his header at the start and
cuts the same amount of bytes from the end of the uploaded file.  So the
file size is still correct but the actual data is rubbish.  I solved
this Problem when by not using a Proxy (option direct connection to the
internet in your browser).


3. You are using a recoding module with Apache, which is then recoding the binary image data.


From WebMasterWorld:
Quote

Your binary files may be uploaded incorrectly if you use modules that recode characters. For example, for Russian Apache, you should use
<Files upload.php>
CharsetDisable On
</Files>


I think this would be in httpd.conf, but I don't use character recoding , so I don't know.

4. Apache's PHP settings are buggy.

Another possibility is an Apache 2.0.40 bug, and the details can be found here:

http://bugs.php.net/bug.php?id=19263

You could try uploading a newer version of Apache 2, if this is what you are using.

There may be more possibilities, but these are a good place to start. These were found on the first two pages of a Google search for 'PHP image upload file is corrupted'.
Title: Re: Uploading problem
Post by: zzzib on June 17, 2004, 10:44:23 AM
YeeeeeeHaaa! SOLVED
I've phoned my hoster and he immediately gave me the link to hosting's instructions.
It's the 3-rd point of your last message, hyperion.
There is a Russian Apache on my hosting.
I've plase .htaccess file containing:
Quote
<IfModule mod_charset.c>
CharsetRecodeMultipartForms off
</IfModule>
And IT WORKS!!!!
THANK YOU, Casper!!
THANK YOU, hyperion!!
THANK YOU, m0nty!!
for help.
Title: Re: [SOLVED!!!!] Uploading problem
Post by: Tarique Sani on June 17, 2004, 11:46:17 AM
@hyperion - awesome support!!
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: Snakeye on July 07, 2004, 02:27:19 PM
When I try to upload .jpg files it works, but when trying to upload .gif files I get the following error. I hope you guys can help me. I'm using lycos for a host. And when i try to upload pictures on my invision forum (same host with GD1) then I am able to upload jpg and gif files.

Error Report
The following uploads encountered errors: 
File Uploads: 
File Name/URL Error Message
1. snakeye.GIF Not a GD extension.



USER:
------------------
Array
(
    [ID] => 98bdc102cc4c4c4c858381f8f9b2bd21
    [am] => 1
    [liv] => Array
        (
           
=> 6
            [1] => 26
            [2] => 25
            [3] => 24
            [4] => 28
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_group] => 1
    [user_active] => YES
    [user_name] => ******
    [user_password] => ********
    [user_lastvisit] => 2004-07-07 13:53:59
    [user_regdate] => 2004-07-06 20:15:28
    [user_group_list] =>
    [user_email] =>
    [user_website] =>
    [user_location] =>
    [user_interests] =>
    [user_occupation] =>
    [user_actkey] =>
    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 1
    [ufc_min] => 1
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 1
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
    [groups] => Array
        (
            [1] => 1
        )

)

==========================
Queries:
------------------
Array
(
   
=> SELECT extension, mime, content FROM cpg130_filetypes;
    [1] => SELECT * FROM cpg130_users WHERE user_id='1'AND user_active = 'YES' AND user_password != '' AND BINARY MD5(user_password) = '*********'
    [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg130_usergroups WHERE group_id in (1)
    [3] => SELECT group_name FROM  cpg130_usergroups WHERE group_id= 1
    [4] => DELETE FROM cpg130_banned WHERE expiry < 1089202413
    [5] => SELECT * FROM cpg130_banned WHERE ip_addr='137.56.102.60' OR ip_addr='137.56.102.60' OR user_id=1
)

==========================
GET :
------------------
Array
(
)

==========================
POST :
------------------
Array
(
    [control] => phase_1
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.2 - OK
------------------
mySQL version: 4.0.18-log
==========================
Module: gd
------------------
module doesn't exist
==========================
Module: mysql
------------------
module doesn't exist
==========================
Module: zlib
------------------
module doesn't exist
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | On | On
safe_mode_exec_dir | /data/apache/php/safe_exec | /data/apache/php/safe_exec
safe_mode_gid | On | On
safe_mode_include_dir | /data/apache/php/mmp_lib:/data/session | /data/apache/php/mmp_lib:/data/session
safe_mode_exec_dir | /data/apache/php/safe_exec | /data/apache/php/safe_exec
sql.safe_mode | Off | Off
disable_functions | highlight_file,diskfreespace, exec, passthru, system, popen, show_source, php_uname, ini_alter, ini_restore, ini_set, getrusage, mysql_list_dbs, get_current_user, set_time_limit, getmyuid, getmypid, dl, leak, chgrp | highlight_file,diskfreespace, exec, passthru, system, popen, show_source, php_uname, ini_alter, ini_restore, ini_set, getrusage, mysql_list_dbs, get_current_user, set_time_limit, getmyuid, getmypid, dl, leak, chgrp
file_uploads | On | On
include_path | .:/data/apache/php/mmp_lib:/data/session | .:/data/apache/php/mmp_lib:/data/session
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail | /usr/sbin/sendmail
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | -1 | -1
upload_max_filesize | 50M | 50M
post_max_size | 50M | 50M
==========================
Page generated in 0.235 seconds - 6 queries in 0.026 seconds - Album set :
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: kegobeer on July 07, 2004, 05:40:42 PM
You do know that GIF isn't supported in GD2, right?  But there's hope: http://www.boutell.com/gd/faq.html
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: Snakeye on July 07, 2004, 06:58:17 PM
Quote from: kegobeer on July 07, 2004, 05:40:42 PM
You do know that GIF isn't supported in GD2, right?  But there's hope: http://www.boutell.com/gd/faq.html

O I didn;t know that. But still I find it strange. On my forum (www.racing-forum.net) I got invision forum installed together with a gallery. It uses GD1 and is able to make thumbnails of .gif files. When I enable GD1 on the coppermine photo gallery I still get the same error. So I think it has to do something with the source code. (Only I got no idea what it could be). I haven't made any changes to the code of the coppermine gallery myself.

BTW I'm sorry for the double posts, something went wrong with my computer.
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: Casper on July 08, 2004, 12:41:19 AM
Quote from: Snakeye on July 07, 2004, 06:58:17 PM
BTW I'm sorry for the double posts, something went wrong with my computer.

You actually posted it 5 times, on 2 boards, but as the boards have been having trouble today(at least from where I'm looking),
we'll acept that was the cause.
if this happens again though, please don't keep trying to submit again  ;)
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: Snakeye on July 08, 2004, 08:48:49 PM
So I can't upload any .gif files at all?  :\'( I'm getting the same error when someone tries to upload a file .JPG (Capital letters) instead of .jpg. Any help would be greatly appreciated.

Thanks in advance,

Snakeye
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: Casper on July 08, 2004, 09:14:46 PM
[EDIT]
use your database tool, and run the following;
QuoteINSERT INTO CPG_filetypes VALUES ('JPG', 'image/JPG', 'image');
INSERT INTO CPG_filetypes VALUES ('JPEG', 'image/JPEG', 'image');
Note, change the 'CPG' to your actual prefix.


You can change the gif settings in the filetype table, set it to document, then you will be able to upload gif's, but will not have thumbs created.
Title: Re: "Not a GD extension", but file is a GD extension.
Post by: Snakeye on July 09, 2004, 10:31:33 AM
Thank you. It's now possible to upload gif files. I just edited the displayimagefile a bit to show the real gif file, but just smaller. But the fix for .JPG doesn't work, because it says 'double entry'. It seems the mysql database doesn't make a distinction between .jpg and .JPG. :( Any other suggestions?

Thanks