+++ /dev/null
-<?php
-/**
- * Copyright 2007-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- */
-
-require_once dirname(__FILE__) . '/../lib/Application.php';
-Horde_Registry::appInit('ansel');
-
-$thumbstyle = Horde_Util::getFormData('t');
-$background = Horde_Util::getFormData('b');
-
-// Create a dummy style object with only what is needed to generate
-if ($thumbstyle && $background) {
- $style = new Ansel_Style(array('thumbstyle' => $thumbstyle,
- 'background' => $background));
-} else {
- $style = null;
-}
-$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage(Horde_Util::getFormData('image'));
-$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery(abs($image->gallery));
-if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) {
- throw new Horde_Exception_PermissionDenied(_("Access denied viewing this photo."));
-}
-
-/* Sendfile support. Lighttpd < 1.5 only understands the X-LIGHTTPD-send-file header */
-if ($conf['vfs']['src'] == 'sendfile') {
- /* Need to ensure the file exists */
- try {
- $image->createView('prettythumb', $style);
- } catch (Horde_Exception $e) {
- Horde::logMessage($e, 'ERR');
- exit;
- }
- $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('prettythumb', $style), $image->getVFSName('prettythumb'));
- header('Content-Type: ' . $image->getType('prettythumb'));
- header('X-LIGHTTPD-send-file: ' . $filename);
- header('X-Sendfile: ' . $filename);
- exit;
-}
-
-$image->display('prettythumb', $style);
<?php
/**
- * Copyright 2003-2010 The Horde Project (http://www.horde.org/)
+ * Copyright 2007-2010 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
- * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
require_once dirname(__FILE__) . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
+$thumbstyle = Horde_Util::getFormData('t');
+$background = Horde_Util::getFormData('b');
+
+// Create a dummy style object with only what is needed to generate
+if ($thumbstyle && $background) {
+ $style = new Ansel_Style(array('thumbstyle' => $thumbstyle,
+ 'background' => $background));
+} else {
+ $style = null;
+}
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage(Horde_Util::getFormData('image'));
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery(abs($image->gallery));
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) {
if ($conf['vfs']['src'] == 'sendfile') {
/* Need to ensure the file exists */
try {
- $image->createView('thumb', Ansel::getStyleDefinition('ansel_default'));
+ $image->createView('thumb', $style);
} catch (Horde_Exception $e) {
- Horde::logMessage($result, 'ERR');
+ Horde::logMessage($e, 'ERR');
exit;
}
- $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('thumb'), $image->getVFSName('thumb'));
+ $filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('thumb', $style), $image->getVFSName('thumb'));
header('Content-Type: ' . $image->getType('thumb'));
header('X-LIGHTTPD-send-file: ' . $filename);
header('X-Sendfile: ' . $filename);
exit;
}
-$image->display('thumb');
+$image->display('thumb', $style);
* factors.
*
* @param string $imageId The id of the image.
- * @param string $view The view ('screen', 'thumb', 'prettythumb' or
- * 'full') to show.
+ * @param string $view The view ('screen', 'thumb', 'full', 'mini')
+ * to show.
* @param boolean $full Return a path that includes the server name?
* @param Ansel_Style $style Use this gallery style
*
// To avoid having to add a new img/* file everytime we add a new
// thumbstyle, we check for the 'non-prettythumb' views, then route the
// rest through prettythumb, passing it the style.
- switch ($view) {
- case 'screen':
- case 'full':
- case 'thumb':
- case 'mini':
- // Do nothing.
- break;
- default:
- $view = 'prettythumb';
- }
+// switch ($view) {
+// case 'screen':
+// case 'full':
+// case 'thumb':
+// case 'mini':
+// // Do nothing.
+// break;
+// default:
+// $view = 'prettythumb';
+// }
if (empty($imageId)) {
return Horde::url((string)Ansel::getErrorImage($view), $full);
{
$styles = $GLOBALS['injector']->getInstance('Ansel_Styles');
- // @TODO: Look at this code: probably duplicated in the binder above.
- /* No prettythumbs allowed at all by admin choice */
- if (empty($GLOBALS['conf']['image']['prettythumbs'])) {
- $test = $styles;
- foreach ($test as $key => $style) {
- if ($style['thumbstyle'] != 'thumb') {
- unset($styles[$key]);
- }
- }
- }
-
/* Build the available styles, but don't show hidden styles */
foreach ($styles as $key => $style) {
if (empty($style['hide'])) {
'view' => 'Image'), true);
if ($gallery->isOldEnough() && !$gallery->hasPasswd()) {
- $img = '<img src="' . Ansel::getImageUrl($imageId, 'thumb', true) . '" alt="[random photo]" />';
+ $img = '<img src="' . Ansel::getImageUrl($imageId, 'thumb', true, Ansel::getStyleDefinition('ansel_default')) . '" alt="[random photo]" />';
} else {
$img = Horde::img('thumb-error.png');
}
/**
* Return a hash key for the given view and style.
*
- * @param string $view The view (thumb, prettythumb etc...)
+ * @param string $view The view (thumb, etc...)
* @param Ansel_Style $style The style.
*
* @return string A md5 hash suitable for use as a key.
$this->_image->setType('jpeg');
}
+ /* Default to the gallery's style */
+ if (empty($style)) {
+ $style = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($this->gallery)->getStyle();
+ }
+
/* Get the VFS info. */
$vfspath = $this->getVFSPath($view, $style);
if ($GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->exists($vfspath, $this->getVFSName($view))) {
$vHash = $this->getViewHash($view, $style);
$this->_image->loadString($data);
- if ($view == 'prettythumb') {
+ if ($view == 'thumb') {
$viewType = $style->thumbstyle;
} else {
- // Screen, Mini, Thumb
+ // Screen, Mini
$viewType = ucfirst($view);
}
} 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 ($view == 'thumb' && $viewType != 'Thumb') {
$iview = Ansel_ImageGenerator::factory('Thumb', array('image' => $this, 'style' => Ansel::getStyleDefinition('ansel_default')));
} else {
// If it wasn't a prettythumb, then something else must be wrong
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 == 'mini' || $view == 'full') {
return $view;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery(abs($this->gallery));
$style = $gallery->getStyle();
}
+
+ if ($view == 'thumb' && $style->thumbstyle == 'Thumb') {
+ return $view;
+ }
+
$view = md5($style->thumbstyle . '.' . $style->background);
return $view;
$style = $dgallery->getStyle();
}
- $thumbstyle = $mini ? 'mini' : $style->thumbstyle;
+ $thumbstyle = $mini ? 'mini' : 'thumb';
$gallery_image = Ansel::getImageUrl(
$dgallery->getKeyImage(),
$thumbstyle,
if (is_null($style)) {
$style = $gallery->getStyle();
}
- $thumbstyle = $mini ? 'mini' : $style->thumbstyle;
+ $thumbstyle = $mini ? 'mini' : 'thumb';
if ($gallery->hasPasswd()) {
$gallery_image = Horde::img('gallery-locked.png');
} else {
}
/* Override the thumbnail to mini or use style default? */
- $thumbstyle = $mini ? 'mini' : $style->thumbstyle;
+ $thumbstyle = $mini ? 'mini' : 'thumb';
/* URL for image properties/actions etc... */
$image_url = Horde::url('image.php')->add(
$thumbsize = (!empty($this->_params['thumbsize'])) ? $this->_params['thumbsize'] : 'mini';
// Limit to these image views only.
if ($thumbsize != 'mini' && $thumbsize != 'thumb' &&
- $thumbsize != 'prettythumb' && $thumbsize != 'screen') {
+ $thumbsize != 'screen') {
$thumbsize = 'mini';
}
// Make sure that the style hash is recorded, ignoring non-styled thumbs
if ($style->thumbstyle != 'Thumb') {
- $GLOBALS['injector']->getInstance('Ansel_Storage')->ensureHash($gallery->getViewHash('prettythumb'));
+ $GLOBALS['injector']->getInstance('Ansel_Storage')->ensureHash($gallery->getViewHash('thumb'));
}
// Clear the OtherGalleries widget cache
try {
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage($imageId);
$gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery(abs($image->gallery));
- $img = Ansel::getImageUrl($imageId, 'thumb', false);
+ $img = Ansel::getImageUrl($imageId, 'thumb', false, Ansel::getStyleDefinition('ansel_default'));
} catch (Ansel_Exception $e) {
Horde::logMessage($e->getMessage(), 'ERR');
exit;