Problem with imagecreatefromgif()
Moderator: General Moderators
-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
Problem with imagecreatefromgif()
My webserver uses:
PHP Version 4.4.2
Zend Optimizer v2.5.10
gd
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
I am simply tring to use imagecreatefromgif() to create a gif. I keep getting the following error:
Warning: imagecreatefromgif(): '/home/omnipcs/public_html/devel/example/components/com_mtree/img/listings/34_test.gif' is not a valid GIF file in /home/omnipcs/public_html/devel/example/components/com_example/includes/example.image.functions.php on line 36
The file is indeed where it should be, it exists, and is a gif that I JUST created in photoshop. I cannot seem to get around this error and I have found nothing on the web to help me.
Can anyone here shed any light onto why I am getting this error? This is how the function is being called:
$logo = imagecreatefromgif($image);
Image points to: /home/omnipcs/public_html/devel/example/components/com_mtree/img/listings/34_test.gif
Which like I said, exists and is in fact a gif.
PHP Version 4.4.2
Zend Optimizer v2.5.10
gd
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
I am simply tring to use imagecreatefromgif() to create a gif. I keep getting the following error:
Warning: imagecreatefromgif(): '/home/omnipcs/public_html/devel/example/components/com_mtree/img/listings/34_test.gif' is not a valid GIF file in /home/omnipcs/public_html/devel/example/components/com_example/includes/example.image.functions.php on line 36
The file is indeed where it should be, it exists, and is a gif that I JUST created in photoshop. I cannot seem to get around this error and I have found nothing on the web to help me.
Can anyone here shed any light onto why I am getting this error? This is how the function is being called:
$logo = imagecreatefromgif($image);
Image points to: /home/omnipcs/public_html/devel/example/components/com_mtree/img/listings/34_test.gif
Which like I said, exists and is in fact a gif.
-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
ok, looking at the gd home page and then following it to http://www.nyphp.org/content/presentations/GDintro/
i came across using getImageSize to print out the images pertinent info. I am getting this:
for a gif. Note the mime setting. Why on earth would this happen? Could it be an improper server config?
i came across using getImageSize to print out the images pertinent info. I am getting this:
Code: Select all
Array ( [0] => 220 [1] => 136 [2] => 2 [3] => width="220" height="136" [bits] => 8 [channels] => 3 [mime] => image/jpeg )-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
the streets will flow with the blood of the non-believers!!!
http://www.omnipcsolutions.com/devel/di ... _test3.GIF
awesome paint skills
http://www.omnipcsolutions.com/devel/di ... _test3.GIF
awesome paint skills
-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
doesn't matter, same results...
thanks for your help btw
Code: Select all
Array ( [0] => 209 [1] => 158 [2] => 2 [3] => width="209" height="158" [bits] => 8 [channels] => 3 [mime] => image/jpeg ) image/jpeg
image/jpeg- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
[feyd@home]>php -r "$filename = 'http://www.omnipcsolutions.com/devel/dineus/components/com_mtree/img/listings/34_test3.GIF'; var_export(getimagesize($filename)); $file = file_get_contents($filename); echo substr($file, 0, 15);"
array (
0 => 209,
1 => 158,
2 => 2,
3 => 'width="209" height="158"',
'bits' => 8,
'channels' => 3,
'mime' => 'image/jpeg',
) ╪ α ►JFIF ☺☺-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
ok, but... I made the file in paint. I saved it as a gif. It is a gif. I did the same thing with photoshop. Trust me when I say that I know how to create and edit graphics. That file, is a gif as far as paint and photoshop are concerned.
I also grabbed some gifs from around the web and I get the same results.
Can you shed any light onto what the problem might be?
I also grabbed some gifs from around the web and I get the same results.
Can you shed any light onto what the problem might be?
-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
I'll be damned...
THANK YOU VERY VERY MUCH!
Now I have to suss out just wth it is that is doing this.
Code: Select all
Array ( [0] => 209 [1] => 158 [2] => 1 [3] => width="209" height="158" [bits] => 8 [channels] => 3 [mime] => image/gif )Now I have to suss out just wth it is that is doing this.
-
spacebass5000
- Forum Newbie
- Posts: 11
- Joined: Tue Mar 21, 2006 7:31 am
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
You mean rename()? You should use move_uploaded_file() when dealing with uploaded files. basename() should be used against the given name to make sure you get just the filename (if you want to even trust that much)..