-
Notifications
You must be signed in to change notification settings - Fork 127
/
image.php
46 lines (41 loc) · 1.31 KB
/
image.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
39
40
41
42
43
44
45
46
<?php
/**
* Process an single image (to be called via Ajax)
*
* Copyright 2008-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 Duck <duck@obala.net>
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
$name = '';
$image_id = (int)Horde_Util::getPost('image');
$reload = (int)Horde_Util::getPost('reload');
$results = $faces->getImageFacesData($image_id);
// Attempt to get faces from the picture if we don't already have results,
// or if we were asked to explicitly try again.
if (($reload || empty($results))) {
$image = $storage->getImage($image_id);
try {
$image->createView(
'screen',
null,
($prefs->getValue('watermark_auto') ?
$prefs->getValue('watermark_text', '') : '')
);
$results = $faces->getFromPicture($image_id, true);
} catch (Ansel_Exception $e) {
Horde::log($e, 'ERR');
$results = null;
}
}
if (!empty($results)) {
$customurl = Horde::url('faces/custom.php');
require_once ANSEL_TEMPLATES . '/faces/image.inc';
} else {
echo _("No faces found");
}