Jump to content


Photo

Problem with imagecreatefromgif()


  • Please log in to reply
3 replies to this topic

#1 spacebass5000

spacebass5000
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 March 2006 - 03:52 PM

My webserver uses:

PHP Version 4.4.2
Zend Optimizer v2.5.10

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.

I have even gone so far as to try this all using jpg's. I don't get any errors but my resultant image is blank. What gives?

#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 21 March 2006 - 04:14 PM

whilst it may not make much difference, the fact that you are getting no errors for Jpg's and you are for gif's indicates SOMETHING wrong with the file format. try making a simple gif file using mspaint or something other than photoshop.

also, can you post your code that youre using to display image files?

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#3 spacebass5000

spacebass5000
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 March 2006 - 04:19 PM

agreed...

looking at the gd home page and then following it to [a href=\"http://www.nyphp.org/content/presentations/GDintro/\" target=\"_blank\"]http://www.nyphp.org/content/presentations/GDintro/[/a]

i came across using getImageSize to print out the images pertinent info. I am getting this:

Array ( [0] => 220 [1] => 136 [2] => 2 [3] => width="220" height="136" [bits] => 8 [channels] => 3 [mime] => image/jpeg )

for a gif. Note the mime setting. Why on earth would this happen? Could it be an improper server config?

I just made a rather awesome graphic in paint and tried using it. Same thing, mime-type came back as a jpeg.

Halp!

#4 spacebass5000

spacebass5000
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 March 2006 - 09:16 PM

ok, here is the weirdness....

obviously the mime-type of my gif is being altered upon upload and storage on the server. when I manually upload and run this code, all is well. when I upload from my browser, it breaks.

Anyone have any insight?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users