Re: imagecreatefromgif fails for a valid image
| From: | Thushara Wijeratna | Date: | Mon, 24 Sep 2007 16:46:23 +0000 |
| Subject: | Re: imagecreatefromgif fails for a valid image | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262423@lists.php.net to get a copy of this message | ||
Hi Tijnema
It does appear to be a GIF. See output from file command below:
for now, to get by I have copied over a libgd.so verion from a working
centos installation over /usr/lib/libgd.so
thanks,
thushara
>> file
>> /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif
/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif:
GIF image data, version 89a, 1 x 28
On 9/24/07, Tijnema <tijnema@gmail.com> wrote:
> On 9/24/07, thushw <thushw@gmail.com> wrote:
> >
> > I get a failure in creating a gif. php error log shows this:
> >
> > Sep 24 00:25:47 thushw-laptop apache2: PHP Warning: imagecreatefromgif() [
> > function.imagecreatefromgif function.imagecreatefromgif ]:
> >
> > '/home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif'
> > is not a valid GIF file in
> > /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/button.php on
> > line 30
> >
> > the gif can be viewed by gthumb. it seems ok.
> >
> > the problem is only for some gifs. Most gifs, all pngs, jpegs that i've
> > tested so far work.
> >
> > i'm running php5 on ubuntu (uname -a : Linux thushw-laptop 2.6.20.3-ubuntu1
> > #2 SMP Sun Apr 15 11:26:58 PDT 2007 i686 GNU/Linux)
> >
> > phpinfo shows:
> >
> > gd
> > GD Support enabled
> > GD Version 2.0 or higher
> > FreeType Support enabled
> > FreeType Linkage with freetype
> > FreeType Version 2.2.1
> > T1Lib Support enabled
> > GIF Read Support enabled
> > GIF Create Support enabled
> > JPG Support enabled
> > PNG Support enabled
> > WBMP Support enabled
> >
> > from what i've read so far, seems like i need gd lib >=2.0.28. from phpinfo
> > output it is not clear if i have the right version. i use: apt-get install
> > php5-gd to install gd
> >
> > these are the files i think are of importance:
> >
> > /usr/lib/libgd.so.2.0.34
> > /usr/lib/libgd.so.2
> >
> > [the second is a symlink to the first]
> >
> > >> ls -l /usr/lib/libgd.so.2
> > lrwxrwxrwx 1 root root 15 2007-09-24 00:25 /usr/lib/libgd.so.2 ->
> > libgd.so.2.0.34
> >
> > how do i debug this further? any help greatly appreciated. this problem
> > doesn't appear with the gd we have installed on our centos servers. seems to
> > happen only on my ubuntu install.
> >
> > thushara
> >
>
> Hello Thushara:
>
> My guess is that your .gif file isn't actually a GIF image (but jpeg, bmp,...).
>
> If you have access to SSH/command line try running
> file /home/thushw/mocha_src/LiveMocha/trunk/src/wwwroot/app/webroot/img/new/button-middle.gif
> and see if it's really a gif, if you don't have access to above, open
> the image with any text editor, and see what the first 3 letters say..
> If it's an GIF image, it says GIF (GIF89 probably)
> if it's an JPEG image, it says something like ÿØÿà
> if it's an BMP image, it says BM (BM6)
> and if it's an PNG image, it says ‰PNG
>
> I hope this helps you..
>
> Tijnema
>