andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


Processing GIF Files

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator
View previous topic :: View next topic  
Author Message
motionbliss
Newbie


Joined: 11 Jul 2005
Posts: 21

PostPosted: Mon Jul 11, 2005 10:48 pm    Post subject: Processing GIF Files Reply with quote

Hi Andy,

What a wonderful job you've done with this resource, and answering people's questions... Perhaps I could impose one additional one on you?

I would very much like to use this technique with both GIF and JPEG files. I noted a post in which you already spoke of the legal issues surrounding the GIF format (below).

Quote:
Support for Gifs?
http://php.amnuts.com/forums/viewtopic.php?t=43


I noticed that the server my Web hosting company runs has something called "GIF create support" enabled (below). Does this in any way allow for the (re)creation of this filetype? Perhaps now permissible? ...and if so, what modifications to the script would be required?

The GD specific's of my hosts server:
Code:

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


If the answer to that is still no, then perhaps you could explain the modifications necessary to convert an inputted GIF into an outputted PNG using this script? Regardless of the file type, I suppose I'm truly only interested in using the drop shadow functionality (if that makes this easier).

Thanks much for your efforts!

Best,

//craig
Phoenix, AZ
Back to top
View user's profile Send private message Visit poster's website
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Tue Jul 12, 2005 4:49 pm    Post subject: Re: Processing GIF Files Reply with quote

motionbliss wrote:
What a wonderful job you've done with this resource, and answering people's questions.


Many thanks, motionbliss, and welcome to the board!

At the time of writing that original thread, GIF files with LZW compression were still under a patent. But that has now expired and people are starting to put back in GIF creation, which is why you find it on your server.

To add the ability to save as a GIF shouldn't be too hard, though I warn you up front that I haven't tried it and am just winging this while looking briefly at the code (it's been over two years since I created the last version, and need a reminder! Wink )

The first thing to do would be add the save option in the _saveImage() method. Change this line:

PHP:
<?php if ($ext == 'png'$saved = @$func($img$filename); ?>


to be:

PHP:
<?php if ($ext == 'png' || $ext == 'gif'$saved = @$func($img$filename); ?>


In the _showImage() method, change this code:

PHP:
<?php if ($type == 'png')
        {
            
header('Content-Type: image/png');
            echo @
ImagePNG($resource);
            return 
TRUE;
        } 
?>


to look like:

PHP:
<?php if ($type == 'png')
        {
            
header('Content-Type: image/png');
            echo @
ImagePNG($resource);
            return 
TRUE;
        } else if (
$type == 'gif') {
            
header('Content-type: image/gif');
            echo @
imagegif($resource);
            return 
true;
        } 
?>


(keep in the jpeg block, too!)

And, erm.. that should be about it, I think. You might have to play around with using imagecreate and imagecreatetruecolor as gif files aren't true colour by paletted.

Incidentally; two years? Wow! I really should try to update these classes more often!! Smile

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
motionbliss
Newbie


Joined: 11 Jul 2005
Posts: 21

PostPosted: Thu Jul 14, 2005 8:22 pm    Post subject: Reply with quote

Thanks so much for the prompt reply Andy! I'll have to give it a whirl... Very Happy
Back to top
View user's profile Send private message Visit poster's website
motionbliss
Newbie


Joined: 11 Jul 2005
Posts: 21

PostPosted: Wed Jul 20, 2005 12:26 am    Post subject: Reply with quote

Didn't play around w/ the saveImage stuff, but the display looks like it's working just fine... Smile

Thanks!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group