Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,679 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,198 people online right now. Registration is fast and FREE... Join Now!




Create gif images using GD

 
Reply to this topicStart new topic

Create gif images using GD, Is it possible to create gif images using GD

silverblaze
post 5 Jun, 2008 - 11:07 AM
Post #1


D.I.C Head

**
Joined: 18 Jan, 2008
Posts: 51



Thanked 3 times
My Contributions


Hello all,

i am currently working in a small scale project for my a client. He is only having a shared server which supports GD only. In this site i want to make a gif images from a set of jpg or png images. Is thier any way to create that. I know how to make display gif images and even i know how to do what i want usng imagemagik. but unfortunatly my clients server doesnt support imagemajik (more over im nt tht much confident in imagemajik as i had only worked with it twice).

Any ref or advice will be greatly appriciated.

thankyou.
User is offlineProfile CardPM

Go to the top of the page

silverblaze
post 6 Jun, 2008 - 01:45 AM
Post #2


D.I.C Head

**
Joined: 18 Jan, 2008
Posts: 51



Thanked 3 times
My Contributions


hello all,

after much research i found the class attached with this post using which i can create gif images. bt the problem i was facing was tht i want to convert jpg images into gif nd gif to animated gif.
Then i made some minor work and now its working fine.

here is hw i did it

CODE
<?php

    include "GIFEncoder.class.php";
    
    for($i=1;$i<6;$i++){
        $imgname = "images/".$i.".jpg";
        $im = @imagecreatefromjpeg($imgname); /* Attempt to open */
        imagegif($im, "images/".$i.".gif");
        $frames[] = "images/".$i.".gif";
        $time[] = 200;
    }
    
        $gif = new GIFEncoder    (
                                $frames, // frames array
                                $time, // elapsed time array
                                0, // loops (0 = infinite)
                                2, // disposal
                                0, 0, 0, // rgb of transparency
                                "url" // source type
            );

// display the image
Header ( 'Content-type:image/gif' );
echo    $gif->GetAnimation ( );

    for($i=1;$i<6;$i++){
        @unlink("images/".$i.".gif");
    }
    

?>


here wht i did is, first i convert the jpg images into gif, thn make the gif and thn delete the gif.

im posting this solutions hoping others with similar problem can solve it easily.

thankyou.

This post has been edited by silverblaze: 6 Jun, 2008 - 01:46 AM


Attached File(s)
Attached File  GIFEncoder.class.php ( 6.75k ) Number of downloads: 67
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 06:41AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month