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