1<?php 2 3namespace Mpdf\Gif; 4 5/** 6 * GIF Util - (C) 2003 Yamasoft (S/C) 7 * 8 * All Rights Reserved 9 * 10 * This file can be freely copied, distributed, modified, updated by anyone under the only 11 * condition to leave the original address (Yamasoft, http://www.yamasoft.com) and this header. 12 * 13 * @link http://www.yamasoft.com 14 */ 15class Gif 16{ 17 18 var $m_gfh; 19 20 var $m_lpData; 21 22 var $m_img; 23 24 var $m_bLoaded; 25 26 public function __construct() 27 { 28 $this->m_gfh = new FileHeader(); 29 $this->m_img = new Image(); 30 $this->m_lpData = ''; 31 $this->m_bLoaded = false; 32 } 33 34 function ClearData() 35 { 36 $this->m_lpData = ''; 37 unset($this->m_img->m_data); 38 unset($this->m_img->m_lzw->Next); 39 unset($this->m_img->m_lzw->Vals); 40 unset($this->m_img->m_lzw->Stack); 41 unset($this->m_img->m_lzw->Buf); 42 } 43 44 function loadFile(&$data, $iIndex) 45 { 46 if ($iIndex < 0) { 47 return false; 48 } 49 $this->m_lpData = $data; 50 51 // GET FILE HEADER 52 $len = 0; 53 if (!$this->m_gfh->load($this->m_lpData, $len)) { 54 return false; 55 } 56 57 $this->m_lpData = substr($this->m_lpData, $len); 58 59 do { 60 $imgLen = 0; 61 if (!$this->m_img->load($this->m_lpData, $imgLen)) { 62 return false; 63 } 64 $this->m_lpData = substr($this->m_lpData, $imgLen); 65 } while ($iIndex-- > 0); 66 67 $this->m_bLoaded = true; 68 return true; 69 } 70} 71