"Not a GD extension", but file is a GD extension. "Not a GD extension", but file is a GD extension.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

"Not a GD extension", but file is a GD extension.

Started by zzzib, June 14, 2004, 11:13:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zzzib

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

Casper

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.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

zzzib

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

Casper

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.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

hyperion

#4
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.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

zzzib

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 :(

zzzib

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?

m0nty

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..

zzzib

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!.. :(

hyperion

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);

?>

&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

zzzib

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" )

zzzib

Casper, any else ideas? :-|

Casper

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]
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

hyperion

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.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

zzzib

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

hyperion

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.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

zzzib

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'

hyperion

#17
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'.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

zzzib

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.

Tarique Sani

SANIsoft PHP applications for E Biz