1: <?php
2: /**
3: * @package image
4: *
5: * @author Андрей Загорцев <freeron@ya.ru>
6: * @author Антон Кургузенков <kurguzenkov@list.ru>
7: *
8: * @version 0.01
9: * @since 2012-11-11
10: */
11:
12: require_once 'AcImage.php';
13: require_once 'geometry/exceptions.php';
14:
15:
16: /**
17: * Класс, описывающий изображение в формате gif
18: */
19:
20: class AcImageGIF extends AcImage
21: {
22:
23: /**
24: * Проверяет, поддерживается ли формат gif
25: *
26: * @return boolean
27: */
28:
29: public static function isSupport()
30: {
31: $gdInfo = parent::getGDinfo();
32: return $gdInfo['GIF Read Support'] && $gdInfo['GIF Create Support'];
33: }
34:
35: /**
36: * @param string путь к файлу с изображением
37: * @throws UnsupportedFormatException
38: */
39:
40: protected function __construct($filePath)
41: {
42: if (!self::isSupport())
43: throw new UnsupportedFormatException('gif');
44:
45: parent::__construct($filePath);
46: $path = parent::getFilePath();
47: parent::setResource(@imagecreatefromgif($path));
48: }
49:
50: /**
51: * @param string путь, по которому будет сохранено изображение
52: * @return AcImage
53: * @throws FileAlreadyExistsException
54: * @throws FileNotSaveException
55: */
56:
57: public function save($path)
58: {
59: return parent::saveAsGIF($path);
60: }
61: }
62: ?>