phpmash Posted June 12, 2006 Share Posted June 12, 2006 Can anyone help me with a code to dispaly an animated GIF image using PHPThanking Youmash Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/ Share on other sites More sharing options...
.josh Posted June 12, 2006 Share Posted June 12, 2006 umm..<img src='blah.gif'>? Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-44638 Share on other sites More sharing options...
phpmash Posted June 12, 2006 Author Share Posted June 12, 2006 I need to upload an animated/nonanimated GIF file in to my site. And display it in another page. So I want to know whether it is possible. First I want to know whether the image is animated or not? If it is not animated I want to add water markIf so how can we display it in my second page. I did it using our conventional GD method BUt the animated effect lost phpmash Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-44715 Share on other sites More sharing options...
WendyLady Posted June 12, 2006 Share Posted June 12, 2006 As far as I know, an animated gif looks the same as a non-animated one, file-wise. Can you add a little checkbox that says "Check here if animated" or something? Not sure what your purpose is, but I don't believe a section of code can figure out if a gif is animated or not. Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-44766 Share on other sites More sharing options...
redarrow Posted June 13, 2006 Share Posted June 13, 2006 [!--quoteo(post=383008:date=Jun 12 2006, 10:58 PM:name=WendyLady)--][div class=\'quotetop\']QUOTE(WendyLady @ Jun 12 2006, 10:58 PM) [snapback]383008[/snapback][/div][div class=\'quotemain\'][!--quotec--]As far as I know, an animated gif looks the same as a non-animated one, file-wise. Can you add a little checkbox that says "Check here if animated" or something? Not sure what your purpose is, but I don't believe a section of code can figure out if a gif is animated or not.[/quote]when a user uploads a animated file make sure the file has a swf exstention then do a check aginst the exstention of swf with regular exspesion. Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-44873 Share on other sites More sharing options...
zq29 Posted June 13, 2006 Share Posted June 13, 2006 ZeBadger from the php.net comments pages wrote the following function to check if a gif is animated or not. I have not tested it, but from looking at the code it is to be executed on a *NIX based machine, although it could be adapted to work with a Windows one, or even make it OS independant.[code]<?phpfunction is_ani($filename){ $filecontents=file_get_contents($filename); $str_loc=0; $count=0; while ($count < 2) { # There is no point in continuing after we find a 2nd frame $where1=strpos($filecontents,"\x00\x21\xF9\x04",$str_loc); if ($where1 === FALSE) { break; } else { $str_loc=$where1+1; $where2=strpos($filecontents,"\x00\x2C",$str_loc); if ($where2 === FALSE) { break; } else { if ($where1+8 == $where2) { $count++; } $str_loc=$where2+1; } } } if ($count > 1) { return(true); } else { return(false); }}exec("ls *gif" ,$allfiles)foreach ($allfiles as $thisfile) { if (is_ani($thisfile)) { echo "$thisfile is animated<BR>\n"; } else { echo "$thisfile is NOT animated<BR>\n"; }}?>[/code]I dropped the semi-colon from the exec() line as it was causing issues posting. Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-44991 Share on other sites More sharing options...
.josh Posted June 13, 2006 Share Posted June 13, 2006 [!--quoteo(post=383116:date=Jun 13 2006, 01:19 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 13 2006, 01:19 AM) [snapback]383116[/snapback][/div][div class=\'quotemain\'][!--quotec--]when a user uploads a animated file make sure the file has a swf exstention then do a check aginst the exstention of swf with regular exspesion.[/quote]dude... .swf is a flash file extension, not a gif file. a gif file is just that - blah.gif. Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-45005 Share on other sites More sharing options...
phpmash Posted June 13, 2006 Author Share Posted June 13, 2006 How can I create a thumbnail for animated image with animated effect? Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-45014 Share on other sites More sharing options...
zq29 Posted June 13, 2006 Share Posted June 13, 2006 [!--quoteo(post=383259:date=Jun 13 2006, 02:36 PM:name=Mash)--][div class=\'quotetop\']QUOTE(Mash @ Jun 13 2006, 02:36 PM) [snapback]383259[/snapback][/div][div class=\'quotemain\'][!--quotec--]How can I create a thumbnail for animated image with animated effect?[/quote]This is possible with [a href=\"http://www.imagemagick.org\" target=\"_blank\"]ImageMagick[/a] I believe. Quote Link to comment https://forums.phpfreaks.com/topic/11787-animated-gif/#findComment-45219 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.