gif - <? / / / GIF Util - (C) 2003 Yamasoft (S/C) /...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
<? /////////////////////////////////////////////////////////////////////////////////// //////////////// // GIF Util - (C) 2003 Yamasoft (S/C) // http://www.yamasoft.com // All Rights Reserved // This file can be frelly copied, distributed, modified, updated by anyone under the only // condition to leave the original address (Yamasoft, http://www.yamasoft.com) and this header. /////////////////////////////////////////////////////////////////////////////////// //////////////// // <gif> = gif_loadFile(filename, [index]) // <bool> = gif_outputAsPng(<gif>, filename, [bgColor]) // <bool> = gif_outputAsBmp(<gif>, filename, [bgcolor]) // <bool> = gif_outputAsJpeg(<gif>, filename, [bgcolor]) - Requires cjpeg /////////////////////////////////////////////////////////////////////////////////// //////////////// /////////////////////////////////////////////////////////////////////////////////// //////////////// / function gif_loadFile($lpszFileName, $iIndex = 0) { $gif = new CGIF(); $ if(!$gif->loadFile($lpszFileName, $iIndex)) { return false; } return $gif; } /////////////////////////////////////////////////////////////////////////////////// //////////////// / function gif_outputAsBmp($gif, $lpszFileName, $bgColor = -1) { if(!isSet($gif) || (@get_class($gif) <> "cgif") || !$gif->loaded() || ($lpszFileName == "")) { return false; } $fd = $gif->getBmp($bgColor); if(strlen($fd) <= 0) { return false; } if(!($fh = @fOpen($lpszFileName, "wb"))) { return false; } @fWrite($fh, $fd, strlen($fd)); @fFlush($fh); @fClose($fh); return true; } /////////////////////////////////////////////////////////////////////////////////// ////////////////
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
/ function gif_outputAsPng($gif, $lpszFileName, $bgColor = -1) { if(!isSet($gif) || (@get_class($gif) <> "cgif") || !$gif->loaded() || ($lpszFileName == "")) { return false; } $fd = $gif->getPng($bgColor); if(strlen($fd) <= 0) { return false; } if(!($fh = @fOpen($lpszFileName, "wb"))) { return false; } @fWrite($fh, $fd, strlen($fd)); @fFlush($fh); @fClose($fh); return true; } /////////////////////////////////////////////////////////////////////////////////// //////////////// / function gif_outputAsJpeg($gif, $lpszFileName, $bgColor = -1) { if(gif_outputAsBmp($gif, "$lpszFileName.bmp", $gbColor)) { exec("cjpeg $lpszFileName.bmp >$lpszFileName 2>/dev/null"); @unLink("$lpszFileName.bmp"); @ if(@file_exists($lpszFileName)) { if(@fileSize($lpszFileName) > 0) { return true; } @unLink($lpszFileName); } } return false; } /////////////////////////////////////////////////////////////////////////////////// //////////////// / { $width = $gif->width(); $height = $gif->height(); } else if(@file_exists($gif)) { $myGIF = new CGIF(); if(!$myGIF->getSize($gif, $width, $height)) { return false; } } else {
Background image of page 2
return false; } return true; } /////////////////////////////////////////////////////////////////////////////////// //////////////// / class CGIFLZW
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 20

gif - &lt;? / / / GIF Util - (C) 2003 Yamasoft (S/C) /...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online