diff options
Diffstat (limited to '')
-rw-r--r-- | include/derivative.inc.php | 45 | ||||
-rw-r--r-- | include/derivative_params.inc.php | 5 | ||||
-rw-r--r-- | include/picture_metadata.inc.php | 4 |
3 files changed, 47 insertions, 7 deletions
diff --git a/include/derivative.inc.php b/include/derivative.inc.php index 11f1ebb76..c22e27573 100644 --- a/include/derivative.inc.php +++ b/include/derivative.inc.php @@ -21,10 +21,14 @@ final class SrcImage { + const IS_ORIGINAL = 0x01; + const IS_MIMETYPE = 0x02; + public $rel_path; - + public $coi=null; private $size=null; + private $flags=0; function __construct($infos) { @@ -34,6 +38,7 @@ final class SrcImage if (in_array($ext, $conf['picture_ext'])) { $this->rel_path = $infos['path']; + $this->flags |= self::IS_ORIGINAL; } elseif (!empty($infos['representative_ext'])) { @@ -44,16 +49,39 @@ final class SrcImage } else { - $this->rel_path = get_themeconf('mime_icon_dir').strtolower($ext).'.png'; + $ext = strtolower($ext); + $this->rel_path = trigger_event('get_mimetype_location', get_themeconf('mime_icon_dir').$ext.'.png', $ext ); + $this->flags |= self::IS_MIMETYPE; + $this->size = @getimagesize(PHPWG_ROOT_PATH.$this->rel_path); } $this->coi = @$infos['coi']; - if (isset($infos['width']) && isset($infos['height'])) + if (!$this->size && isset($infos['width']) && isset($infos['height'])) { $this->size = array($infos['width'], $infos['height']); } } + function is_original() + { + return $this->flags & self::IS_ORIGINAL; + } + + function is_mimetype() + { + return $this->flags & self::IS_MIMETYPE; + } + + function get_path() + { + return PHPWG_ROOT_PATH.$this->rel_path; + } + + function get_url() + { + return get_root_url().$this->rel_path; + } + function has_size() { return $this->size != null; @@ -126,7 +154,7 @@ final class DerivativeImage { $ret[$type] = $ret[$type2]; } - + return $ret; } @@ -144,7 +172,7 @@ final class DerivativeImage $tokens=array(); $tokens[] = substr($params->type,0,2); - if (!empty($src->coi)) + if ($params->sizing->max_crop != 0 and !empty($src->coi)) { $tokens[] = 'ci'.$src->coi; } @@ -206,6 +234,13 @@ final class DerivativeImage } + function get_type() + { + if ($this->flags & self::SAME_AS_SRC) + return 'original'; + return $this->params->type; + } + /* returns the size of the derivative image*/ function get_size() { diff --git a/include/derivative_params.inc.php b/include/derivative_params.inc.php index 9fe76cd43..a84c0f854 100644 --- a/include/derivative_params.inc.php +++ b/include/derivative_params.inc.php @@ -19,6 +19,11 @@ // | USA. | // +-----------------------------------------------------------------------+ +function derivative_to_url($t) +{ + return substr($t, 0, 2); +} + function size_to_url($s) { if ($s[0]==$s[1]) diff --git a/include/picture_metadata.inc.php b/include/picture_metadata.inc.php index db0aff887..49bb9f011 100644 --- a/include/picture_metadata.inc.php +++ b/include/picture_metadata.inc.php @@ -36,7 +36,7 @@ if (($conf['show_exif']) and (function_exists('read_exif_data'))) $exif_mapping[$field] = $field; } - $exif = get_exif_data($picture['current']['image_path'], $exif_mapping); + $exif = get_exif_data($picture['current']['src_image']->get_path(), $exif_mapping); if (count($exif) > 0) { @@ -79,7 +79,7 @@ if (($conf['show_exif']) and (function_exists('read_exif_data'))) if ($conf['show_iptc']) { - $iptc = get_iptc_data($picture['current']['image_path'], $conf['show_iptc_mapping']); + $iptc = get_iptc_data($picture['current']['src_image']->get_path(), $conf['show_iptc_mapping']); if (count($iptc) > 0) { |