1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Contacts: Read and echo image instead of redirect. Fewer request == faster.

This commit is contained in:
Thomas Tanghus 2013-02-23 21:26:40 +01:00
parent 75c1302197
commit 219ce43fb2

View File

@ -27,14 +27,20 @@ session_write_close();
//OCP\Util::writeLog('contacts', OCP\Util::getRequestUri(), OCP\Util::DEBUG);
function getStandardImage() {
$image = new \OC_Image();
$file = __DIR__ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'person.png';
OCP\Response::setLastModifiedHeader(filemtime($file));
OCP\Response::enableCaching();
OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png'));
$image->loadFromFile($file);
$image();
exit();
}
if(!extension_loaded('gd') || !function_exists('gd_info')) {
OCP\Util::writeLog('contacts',
'thumbnail.php. GD module not installed', OCP\Util::DEBUG);
getStandardImage();
OCP\Response::enableCaching();
OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png'));
exit();
}