-
Notifications
You must be signed in to change notification settings - Fork 127
/
screen.php
38 lines (35 loc) · 1.37 KB
/
screen.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Copyright 2003-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Chuck Hagenbuch <chuck@horde.org>
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$image = $storage->getImage(Horde_Util::getFormData('image'));
$gallery = $storage->getGallery($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(
'screen',
Ansel::getStyleDefinition('ansel_default'),
($GLOBALS['prefs']->getValue('watermark_auto') ?
$GLOBALS['prefs']->getValue('watermark_text', '') : '')
);
} catch (Ansel_Exception $e) {
Horde::log($result, 'ERR');
exit;
}
$filename = $injector->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen'));
Ansel::doSendfile($filename, $image->getType('screen'));
exit;
}
$image->display('screen');