*/
public function __construct($image = array())
{
- if ($image)
- {
+ if ($image) {
$this->filename = $image['image_filename'];
- if (!empty($image['gallery_id']))
- {
+ if (!empty($image['gallery_id'])) {
$this->gallery = $image['gallery_id'];
}
- if (!empty($image['image_caption']))
- {
+ if (!empty($image['image_caption'])) {
$this->caption = $image['image_caption'];
}
- if (isset($image['image_sort']))
- {
+ if (isset($image['image_sort'])) {
$this->sort = $image['image_sort'];
}
- if (!empty($image['image_id']))
- {
+ if (!empty($image['image_id'])) {
$this->id = $image['image_id'];
}
- if (!empty($image['data']))
- {
+ if (!empty($image['data'])) {
$this->_data['full'] = $image['data'];
}
- if (!empty($image['image_uploaded_date']))
- {
+ if (!empty($image['image_uploaded_date'])) {
$this->uploaded = $image['image_uploaded_date'];
- } else
- {
+ } else {
$this->uploaded = time();
}
- if (!empty($image['image_type']))
- {
+ if (!empty($image['image_type'])) {
$this->type = $image['image_type'];
}
- if (!empty($image['tags']))
- {
+ if (!empty($image['tags'])) {
$this->_tags = $image['tags'];
}
- if (!empty($image['image_faces']))
- {
+ if (!empty($image['image_faces'])) {
$this->facesCount = $image['image_faces'];
}
if (!empty($image['image_original_date']))
{
$this->originalDate = $image['image_original_date'];
- } else
- {
+ } else {
$this->originalDate = $this->uploaded;
}
$this->lat = !empty($image['image_latitude']) ? $image['image_latitude'] : '';
{
$vfsname = $this->id;
- if ($view == 'full' && $this->type)
- {
+ if ($view == 'full' && $this->type) {
$type = strpos($this->type, '/') === false ? 'image/' . $this->type : $this->type;
- if ($ext = Horde_Mime_Magic::mimeToExt($type))
- {
+ if ($ext = Horde_Mime_Magic::mimeToExt($type)) {
$vfsname .= '.' . $ext;
}
- } elseif (($GLOBALS['conf']['image']['type'] == 'jpeg') || $view == 'screen')
- {
+ } elseif (($GLOBALS['conf']['image']['type'] == 'jpeg') || $view == 'screen') {
$vfsname .= '.jpg';
- } else
- {
+ } else {
$vfsname .= '.png';
}
// If this is a new image that hasn't been saved yet, we will
// already have the full data loaded. If we auto-rotate the image
// then there is no need to save it just to load it again.
- if ($view == 'full' && !empty($this->_data['full']))
- {
+ if ($view == 'full' && !empty($this->_data['full'])) {
$this->_image->loadString($this->_data['full']);
$this->_loaded['full'] = true;
return true;
$viewHash = $this->getViewHash($view, $style);
/* If we've already loaded the data, just return now. */
- if (!empty($this->_loaded[$viewHash]))
- {
+ if (!empty($this->_loaded[$viewHash])) {
return true;
}
$this->createView($view, $style);
/* If createView() had to resize the full image, we've already
* loaded the data, so return now. */
- if (!empty($this->_loaded[$viewHash]))
- {
+ if (!empty($this->_loaded[$viewHash])) {
return;
}
$vfspath = $this->getVFSPath($view, $style);
/* Read in the requested view. */
- try
- {
+ try {
$data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($vfspath, $this->getVFSName($view));
- } catch (VFS_Exception $e)
- {
+ } catch (VFS_Exception $e) {
Horde::logMessage($e, 'ERR');
throw new Ansel_Exception($e);
}
public function viewExists($id, $view, $style)
{
/* We cannot check empty styles since we cannot get the hash */
- if (empty($style))
- {
+ if (empty($style)) {
return false;
}
/* Get VFS name */
$vfsname = $id . '.';
- if ($GLOBALS['conf']['image']['type'] == 'jpeg' || $view == 'screen')
- {
+ if ($GLOBALS['conf']['image']['type'] == 'jpeg' || $view == 'screen') {
$vfsname .= 'jpg';
- } else
- {
+ } else {
$vfsname .= 'png';
}
- if ($GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $vfsname))
- {
+ if ($GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $vfsname)) {
return $view . '/' . $vfsname;
- } else
- {
+ } else {
return false;
}
}
public function createView($view, $style = null)
{
/* Force screen images to ALWAYS be jpegs for performance/size */
- if ($view == 'screen' && $GLOBALS['conf']['image']['type'] != 'jpeg')
- {
+ if ($view == 'screen' && $GLOBALS['conf']['image']['type'] != 'jpeg') {
$this->_image->setType('jpeg');
}
/* Get the VFS info. */
$vfspath = $this->getVFSPath($view, $style);
- if ($GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $this->getVFSName($view)))
- {
+ if ($GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->exists($vfspath, $this->getVFSName($view))) {
return true;
}
- try
- {
+ try {
$data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($this->getVFSPath('full'), $this->getVFSName('full'));
- } catch (VFS_Exception $e)
- {
+ } catch (VFS_Exception $e) {
Horde::logMessage($e, 'ERR');
throw new Ansel_Exception($e);
}
$vHash = $this->getViewHash($view, $style);
$this->_image->loadString($data);
$styleDef = Ansel::getStyleDefinition($style);
- if ($view == 'prettythumb')
- {
+ if ($view == 'prettythumb') {
$viewType = $styleDef['thumbstyle'];
- } else
- {
+ } else {
// Screen, Mini, Thumb
$viewType = ucfirst($view);
}
- try
- {
+ try {
$iview = Ansel_ImageGenerator::factory($viewType, array('image' => $this, 'style' => $style));
- } catch (Ansel_Exception $e)
- {
+ } catch (Ansel_Exception $e) {
// It could be we don't support the requested effect, try
// ansel_default before giving up.
- if ($view == 'prettythumb')
- {
+ if ($view == 'prettythumb') {
// If we still fail, the exception gets thrown up the chain.
$iview = Ansel_ImageGenerator::factory('Thumb', array('image' => $this, 'style' => 'ansel_default'));
- } else
- {
+ } else {
// If it wasn't a prettythumb, then something else must be wrong
throw $e;
}
$iview->create();
/* Cache the data from the new ImageGenerator */
- try
- {
+ try {
$this->_data[$vHash] = $this->_image->raw();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
/* Autowatermark the screen view */
if ($view == 'screen' &&
$GLOBALS['prefs']->getValue('watermark_auto') &&
- $GLOBALS['prefs']->getValue('watermark_text') != '')
- {
+ $GLOBALS['prefs']->getValue('watermark_text') != '') {
$this->watermark('screen');
$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData($vfspath, $this->getVFSName($view), $this->_image->_data);
{
$this->_dirty = false;
- try
- {
+ try {
$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData($this->getVFSPath('full'),
$this->getVFSName('full'),
$this->_data['full'], true);
- } catch (VFS_Exception $e)
- {
+ } catch (VFS_Exception $e) {
throw new Ansel_Exception($e);
}
public function updateData($data, $view = 'full')
{
/* Delete old cached data if we are replacing the full image */
- if ($view == 'full')
- {
+ if ($view == 'full') {
$this->deleteCache();
}
- try
- {
+ try {
$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->writeData($this->getVFSPath($view),
$this->getVFSName($view),
$data, true);
- } catch (VFS_Exception $e)
- {
+ } catch (VFS_Exception $e) {
throw new Ansel_Exception($e);
}
}
public function save()
{
/* Existing image, just save and exit */
- if ($this->id)
- {
+ if ($this->id) {
/* Save image details */
return $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImage($this);
}
$this->_writeData();
/* Get the EXIF data if we are not a gallery key image. */
- if ($this->gallery > 0)
- {
+ if ($this->gallery > 0) {
$needUpdate = $this->_getEXIF();
}
/* Create tags from exif data if desired */
$fields = @unserialize($GLOBALS['prefs']->getValue('exif_tags'));
- if ($fields)
- {
+ if ($fields) {
$this->_exifToTags($fields);
}
/* Save the tags */
- if (count($this->_tags))
- {
- $result = $this->setTags($this->_tags);
- if ($result instanceof PEAR_Error)
- {
+ if (count($this->_tags)) {
+ try {
+ $this->setTags($this->_tags);
+ } catch (Exception $e) {
// Since we got this far, the image has been added, so
// just log the tag failure.
- Horde::logMessage($result, 'ERR');
+ Horde::logMessage($e, 'ERR');
}
}
/* Save again if EXIF changed any values */
- if (!empty($needUpdate))
- {
+ if (!empty($needUpdate)) {
$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImage($this);
}
/* Remove attributes */
$result = $GLOBALS['ansel_db']->exec('DELETE FROM ansel_image_attributes WHERE image_id = ' . (int)$this->id);
- if ($result instanceof PEAR_Error)
- {
+ if ($result instanceof PEAR_Error) {
throw new Ansel_Exception($result);
}
protected function _exifToTags($fields = array())
{
$tags = array();
- foreach ($fields as $field)
- {
- if (!empty($this->_exif[$field]))
- {
- if (substr($field, 0, 8) == 'DateTime')
- {
+ foreach ($fields as $field) {
+ if (!empty($this->_exif[$field])) {
+ if (substr($field, 0, 8) == 'DateTime') {
$d = new Horde_Date(strtotime($this->_exif[$field]));
$tags[] = $d->format("Y-m-d");
- } elseif ($field == 'Keywords')
- {
+ } elseif ($field == 'Keywords') {
$tags = array_merge($tags, explode(',', $this->_exif[$field]));
- } else
- {
+ } else {
$tags[] = $this->_exif[$field];
}
}
$this->_exif = array();
/* Get the data */
- try
- {
+ try {
$imageFile = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->readFile($this->getVFSPath('full'),
$this->getVFSName('full'));
- } catch (VFS_Exception $e)
- {
+ } catch (VFS_Exception $e) {
throw new Ansel_Exception($e);
}
$exif = Horde_Image_Exif::factory($GLOBALS['conf']['exif']['driver'], !empty($GLOBALS['conf']['exif']['params']) ? $GLOBALS['conf']['exif']['params'] : array());
- try
- {
+ try {
$exif_fields = $exif->getData($imageFile);
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
// Log the error, but it's not the end of the world, so just ignore
Horde::logMessage($e, 'ERR');
$exif_fields = array();
$needUpdate = false;
/* Populate any local properties that come from EXIF */
- if (!empty($exif_fields['GPSLatitude']))
- {
+ if (!empty($exif_fields['GPSLatitude'])) {
$this->lat = $exif_fields['GPSLatitude'];
$this->lng = $exif_fields['GPSLongitude'];
$this->geotag_timestamp = time();
$needUpdate = true;
}
- if (!empty($exif_fields['DateTimeOriginal']))
- {
+ if (!empty($exif_fields['DateTimeOriginal'])) {
$this->originalDate = $exif_fields['DateTimeOriginal'];
$needUpdate = true;
}
/* Overwrite any existing value for caption with exif data */
$exif_title = $GLOBALS['prefs']->getValue('exif_title');
- if (!empty($exif_fields[$exif_title]))
- {
+ if (!empty($exif_fields[$exif_title])) {
$this->caption = $exif_fields[$exif_title];
$needUpdate = true;
}
$this->_autoRotate();
/* Save attributes. */
- foreach ($exif_fields as $name => $value)
- {
+ foreach ($exif_fields as $name => $value) {
$GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->saveImageAttribute($this->id, $name, $value);
$this->_exif[$name] = Horde_Image_Exif::getHumanReadable($name, $value);
}
*/
protected function _autoRotate()
{
- if (isset($this->_exif['Orientation']) && $this->_exif['Orientation'] != 1)
- {
- switch ($this->_exif['Orientation'])
- {
- case 2:
- $this->mirror();
- break;
-
- case 3:
- $this->rotate('full', 180);
- break;
-
- case 4:
- $this->mirror();
- $this->rotate('full', 180);
- break;
-
- case 5:
- $this->flip();
- $this->rotate('full', 90);
- break;
-
- case 6:
- $this->rotate('full', 90);
- break;
-
- case 7:
- $this->mirror();
- $this->rotate('full', 90);
- break;
-
- case 8:
- $this->rotate('full', 270);
- break;
+ if (isset($this->_exif['Orientation']) && $this->_exif['Orientation'] != 1) {
+ switch ($this->_exif['Orientation']) {
+ case 2:
+ $this->mirror();
+ break;
+
+ case 3:
+ $this->rotate('full', 180);
+ break;
+
+ case 4:
+ $this->mirror();
+ $this->rotate('full', 180);
+ break;
+
+ case 5:
+ $this->flip();
+ $this->rotate('full', 90);
+ break;
+
+ case 6:
+ $this->rotate('full', 90);
+ break;
+
+ case 7:
+ $this->mirror();
+ $this->rotate('full', 90);
+ break;
+
+ case 8:
+ $this->rotate('full', 270);
+ break;
}
- if ($this->_dirty)
- {
+ if ($this->_dirty) {
$this->_exif['Orientation'] = 1;
$this->data['full'] = $this->raw();
$this->_writeData();
public function deleteCache($view = 'all')
{
/* Catch exceptions from VFS */
- try
- {
+ try {
/* Delete cached screen image. (We don't care if the file is not found) */
- if ($view == 'all' || $view == 'screen')
- {
+ if ($view == 'all' || $view == 'screen') {
$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($this->getVFSPath('screen'),
$this->getVFSName('screen'));
}
/* Delete cached thumbnail. */
- if ($view == 'all' || $view == 'thumb')
- {
+ if ($view == 'all' || $view == 'thumb') {
$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($this->getVFSPath('thumb'),
$this->getVFSName('thumb'));
}
/* Delete cached mini image. */
- if ($view == 'all' || $view == 'mini')
- {
+ if ($view == 'all' || $view == 'mini') {
$GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->deleteFile($this->getVFSPath('mini'),
$this->getVFSName('mini'));
}
- if ($view == 'all' || $view == 'prettythumb')
- {
+ if ($view == 'all' || $view == 'prettythumb') {
/* No need to try to delete a hash we already removed */
$deleted = array();
}
}
}
- } catch (VFS_Exception $e)
- {
-
- }
+ } catch (VFS_Exception $e) {}
}
/**
*/
public function raw($view = 'full')
{
- if ($this->_dirty)
- {
+ if ($this->_dirty) {
return $this->_image->raw();
- } else
- {
+ } else {
$this->load($view);
return $this->_data[$view];
}
global $browser, $conf;
$filename = $this->filename;
- if ($view != 'full')
- {
- if ($ext = Horde_Mime_Magic::mimeToExt('image/' . $conf['image']['type']))
- {
+ if ($view != 'full') {
+ if ($ext = Horde_Mime_Magic::mimeToExt('image/' . $conf['image']['type'])) {
$filename .= '.' . $ext;
}
}
*/
public function display($view = 'full', $style = null)
{
- if ($view == 'full' && !$this->_dirty)
- {
+ if ($view == 'full' && !$this->_dirty) {
// Check full photo permissions
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->gallery);
- if ($gallery instanceof PEAR_Error)
- {
+ if ($gallery instanceof PEAR_Error) {
throw new Ansel_Exception($gallery);
}
- if (!$gallery->canDownload())
- {
+ if (!$gallery->canDownload()) {
throw Horde_Exception_PermissionDenied(sprintf(_("Access denied downloading photos from \"%s\"."), $gallery->get('name')));
}
- try
- {
+ try {
$data = $GLOBALS['injector']->getInstance('Horde_Vfs')->getVfs('images')->read($this->getVFSPath('full'),
$this->getVFSName('full'));
- } catch (VFS_Exception $e)
- {
+ } catch (VFS_Exception $e) {
throw new Ansel_Exception($e);
}
echo $data;
- } else
- {
+ } else {
$this->load($view, $style);
$this->_image->display();
}
*/
public function toFile($view = 'full')
{
- try
- {
+ try {
$this->load($view);
return $this->_image->toFile($this->_dirty ? false : $this->_data[$view]);
- } catch (Horde_Exception $e)
- {
+ } catch (Horde_Exception $e) {
Horde::logMessage($e, 'ERR');
throw new Ansel_Exception($e);
}
*/
public function getDimensions($view = 'full')
{
- try
- {
+ try {
$this->load($view);
return $this->_image->getDimensions();
- } catch (Horde_Exception $e)
- {
+ } catch (Horde_Exception $e) {
Horde::logMessage($e, 'INFO');
throw new Ansel_Exception($e);
}
public function crop($x1, $y1, $x2, $y2)
{
$this->_dirty = true;
- try
- {
+ try {
$this->_image->crop($x1, $y1, $x2, $y2);
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function resize($width, $height, $ratio = true, $keepProfile = false)
{
- try
- {
+ try {
$this->_image->resize($width, $height, $ratio, $keepProfile);
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
{
$this->load($view);
$this->_dirty = true;
- try
- {
+ try {
$this->_image->grayscale();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
public function watermark($view = 'full', $watermark = null, $halign = null,
$valign = null, $font = null)
{
- if (empty($watermark))
- {
+ if (empty($watermark)) {
$watermark = $GLOBALS['prefs']->getValue('watermark_text');
}
-
- if (empty($halign))
- {
+ if (empty($halign)) {
$halign = $GLOBALS['prefs']->getValue('watermark_horizontal');
}
-
- if (empty($valign))
- {
+ if (empty($valign)) {
$valign = $GLOBALS['prefs']->getValue('watermark_vertical');
}
-
- if (empty($font))
- {
+ if (empty($font)) {
$font = $GLOBALS['prefs']->getValue('watermark_font');
}
-
- if (empty($watermark))
- {
+ if (empty($watermark)) {
$identity = $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getIdentity();
$name = $identity->getValue('fullname');
- if (empty($name))
- {
+ if (empty($name)) {
$name = $GLOBALS['registry']->getAuth();
}
$watermark = sprintf(_("(c) %s %s"), date('Y'), $name);
'halign' => $halign,
'valign' => $valign,
'fontsize' => $font);
- if (!empty($GLOBALS['conf']['image']['font']))
- {
+ if (!empty($GLOBALS['conf']['image']['font'])) {
$params['font'] = $GLOBALS['conf']['image']['font'];
}
- try
- {
+ try {
$this->_image->addEffect('TextWatermark', $params);
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
$this->load($view);
$this->_dirty = true;
- try
- {
+ try {
$this->_image->flip();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
{
$this->load($view);
$this->_dirty = true;
- try
- {
+ try {
$this->_image->mirror();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function addEffect($type, $params = array())
{
- try
- {
+ try {
$this->_image->addEffect($type, $params);
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
Horde::logMessage($e, 'ERR');
throw new Ansel_Exception($e);
}
*/
public function applyEffects()
{
- try
- {
+ try {
$this->_image->applyEffects();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function getTags()
{
- if (count($this->_tags))
- {
+ if (count($this->_tags)) {
return $this->_tags;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->gallery);
- if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ))
- {
+ if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
return $GLOBALS['injector']->getInstance('Ansel_Tagger')->getTags($this->id, 'image');
- } else
- {
+ } else {
throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo."));
}
}
public function setTags($tags)
{
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($this->gallery));
- if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT))
- {
+ if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
// Clear the local cache.
$this->_tags = array();
$GLOBALS['injector']->getInstance('Ansel_Tagger')->tag($this->id, $tags, $gallery->get('owner'), 'image');
- } else
- {
+ } else {
throw new Horde_Exception_PermissionDenied(_("Access denied adding tags to this photo."));
}
}
*/
public function getTile($parent = null, $style = null, $mini = false, $params = array())
{
- if (!is_null($parent) && is_null($style))
- {
+ if (!is_null($parent) && is_null($style)) {
$style = $parent->getStyle();
- } else
- {
+ } else {
$style = Ansel::getStyleDefinition($style);
}
*/
public function getType($view = 'full')
{
- if ($view == 'full')
- {
+ if ($view == 'full') {
return $this->type;
- } elseif ($view == 'screen')
- {
+ } elseif ($view == 'screen') {
return 'image/jpg';
- } else
- {
+ } else {
return 'image/' . $GLOBALS['conf']['image']['type'];
}
}
public function getViewHash($view, $style = null)
{
// These views do not care about style...just return the $view value.
- if ($view == 'screen' || $view == 'thumb' || $view == 'mini' || $view == 'full')
- {
+ if ($view == 'screen' || $view == 'thumb' || $view == 'mini' || $view == 'full') {
return $view;
}
- if (is_null($style))
- {
+ if (is_null($style)) {
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery(abs($this->gallery));
$style = $gallery->getStyle();
- } else
- {
+ } else {
$style = Ansel::getStyleDefinition($style);
}
$view = md5($style['thumbstyle'] . '.' . $style['background']);
$fields = Horde_Image_Exif::getFields($exif);
$output = array();
- foreach ($fields as $field => $data)
- {
- if (!isset($attributes[$field]))
- {
+ foreach ($fields as $field => $data) {
+ if (!isset($attributes[$field])) {
continue;
}
$value = Horde_Image_Exif::getHumanReadable($field, Horde_String::convertCharset($attributes[$field], $GLOBALS['conf']['sql']['charset']));
- if (!$format)
- {
+ if (!$format) {
$output[$field] = $value;
- } else
- {
+ } else {
$description = isset($data['description']) ? $data['description'] : $field;
$output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</td>';
}
public function isMultiPage()
{
$this->load();
- try
- {
+ try {
return $this->_image->getImagePageCount() > 1;
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function getImagePageCount()
{
- if (empty($this->_loaded['full']))
- {
+ if (empty($this->_loaded['full'])) {
$this->load();
}
- try
- {
+ try {
return $this->_image->getImagePageCount();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function rewind()
{
- if (empty($this->_loaded['full']))
- {
+ if (empty($this->_loaded['full'])) {
$this->load();
}
- try
- {
+ try {
$this->_image->rewind();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function current()
{
- if (empty($this->_loaded['full']))
- {
+ if (empty($this->_loaded['full'])) {
$this->load();
}
- try
- {
+ try {
return $this->_buildImageObject($this->_image->current());
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function key()
{
- if (empty($this->_loaded['full']))
- {
+ if (empty($this->_loaded['full'])) {
$this->load();
}
- try
- {
+ try {
return $this->_image->key();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
*/
public function next()
{
- if (empty($this->_loaded['full']))
- {
+ if (empty($this->_loaded['full'])) {
$this->load();
}
- if ($next = $this->_image->next())
- {
+ if ($next = $this->_image->next()) {
return $this->_buildImageObject($next);
}
*/
public function valid()
{
- if (empty($this->_loaded['full']))
- {
+ if (empty($this->_loaded['full'])) {
$this->load();
}
- try
- {
+ try {
return $this->_image->valid();
- } catch (Horde_Image_Exception $e)
- {
+ } catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
'image_filename' => $this->filename,
'data' => $image->raw(),
);
-
$newImage = new Ansel_Image($params);
return $newImage;