Author: ralfbecker
New Revision: 55657
URL: http://svn.stylite.de/viewvc/egroupware?rev=55657&view=rev
Log:
move thumbnailer to api
Added:
trunk/egroupware/api/thumbnail.php
- copied, changed from r55642, trunk/etemplate/thumbnail.php
Removed:
trunk/etemplate/thumbnail.php
Modified:
trunk/egroupware/api/src/Html.php
trunk/egroupware/api/src/Vfs.php
trunk/etemplate/inc/class.vfs_widget.inc.php
trunk/phpgwapi/js/jsapi/egw_images.js
— trunk/egroupware/api/src/Html.php (original)
+++ trunk/egroupware/api/src/Html.php Wed Apr 6 21:39:49 2016
@@ -892,7 +892,7 @@
{
$name = egw::link(Vfs::download_url(substr($name,4)));
}
-
if ($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://' || stripos($name,'etemplate/thumbnail.php') )
-
if ($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://' || stripos($name,'api/thumbnail.php') )
{
if (!($name[0] == '/' || substr($name,0,7) == 'http://' || substr($name,0,8) == 'https://')) $name = '/'.$name;
$url = $name;
— trunk/egroupware/api/src/Vfs.php (original)
+++ trunk/egroupware/api/src/Vfs.php Wed Apr 6 21:39:49 2016
@@ -1903,7 +1903,7 @@
{
$thparams[‘thsize’] = $thsize;
}
— trunk/etemplate/thumbnail.php (original)
+++ trunk/egroupware/api/thumbnail.php Wed Apr 6 21:39:49 2016
@@ -10,6 +10,8 @@
+use EGroupware\Api;
+use EGroupware\Api\Vfs;
//Set all necessary info and fire up egroupware
$GLOBALS[‘egw_info’][‘flags’] = array(
@@ -44,10 +46,10 @@
}
else
{
/**
@@ -103,7 +105,7 @@
function read_thumbnail($src)
{
//Check whether the source file is readable and exists
- if (!file_exists($src) || !egw_vfs::is_readable($src))
-
if (!file_exists($src) || !Vfs::is_readable($src))
{
return false;
}
@@ -134,14 +136,14 @@
// Generate the destination filename and check whether the destination directory
// had been successfully created (the cache class used in gen_dstfile does that).
- $stat = egw_vfs::stat(egw_vfs::parse_url($src, PHP_URL_PATH));
-
$stat = Vfs::stat(Vfs::parse_url($src, PHP_URL_PATH));
// if pdf-thumbnail-creation is not available, generate a single scaled-down pdf-icon
- if ($stat && Vfs::mime_content_type($src) == ‘application/pdf’ && !pdf_thumbnails_available())
- {
-
list($app, $icon) = explode('/', Vfs::mime_icon('application/pdf'), 2);
list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'],
@@ -176,10 +178,10 @@
// simply output the mime type icon
if (!$exists)
{
-
$mime = egw_vfs::mime_content_type($src);
-
list($app, $icon) = explode('/', egw_vfs::mime_icon($mime), 2);
-
$mime = Vfs::mime_content_type($src);
-
list($app, $icon) = explode('/', Vfs::mime_icon($mime), 2);
list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'],
@@ -188,7 +190,7 @@
{
// Allow client to cache these, makes scrolling in filemanager much nicer
// setting maximum allow caching time of one year, if url contains (non-empty) moditication time
@@ -213,9 +215,9 @@
function gen_dstfile($src, $maxsize, $height=null, $width=null, $minsize=null)
{
// Use the egroupware file cache to store the thumbnails on a per instance basis
- $cachefile = new egw_cache_files(array());
- $cachefile = new Api\Cache\Files(array());
$size = ($height > 0 ? ‘h’.$height : ($width > 0 ? ‘w’.$height : ($minsize > 0 ? ‘m’.$minsize : $maxsize)));
- return $cachefile->filename(egw_cache::keys(egw_cache::INSTANCE, ‘etemplate’,
- return $cachefile->filename(Api\Cache::keys(Api\Cache::INSTANCE, ‘etemplate’,
‘thumb_’.md5($src.$size).’.png’), true);
}
@@ -300,9 +302,9 @@
function gd_image_load($file,$maxw,$maxh)
{
// Get mime type
- list($type, $image_type) = explode(’/’, $mime = egw_vfs::mime_content_type($file));
- // if $file is not from vfs, use mime_magic::filename2mime to get mime-type from extension
- if (!$type) list($type, $image_type) = explode(’/’, $mime = mime_magic::filename2mime($file));
-
list($type, $image_type) = explode(’/’, $mime = Vfs::mime_content_type($file));
-
// if $file is not from vfs, use Api\MimeMagic::filename2mime to get mime-type from extension
-
if (!$type) list($type, $image_type) = explode(’/’, $mime = Api\MimeMagic::filename2mime($file));
// Call the according gd constructor depending on the file type
if($type == ‘image’)
@@ -322,9 +324,9 @@
case ‘bmp’:
return imagecreatefromwbmp($file);
case ‘svg+xml’:
-
exit;
}
}
else if ($type == ‘application’)
@@ -358,7 +360,7 @@
imagecopyresampled($img_dst, $thumb, 0, 0, 0, 0, $sw, $sh, imagesx($thumb), imagesy($thumb));
$thumb = $img_dst;
}
@@ -381,7 +383,7 @@
*/
function get_opendocument_thumbnail($file)
{
- $mimetype = explode(’/’, egw_vfs::mime_content_type($file));
-
$mimetype = explode(’/’, Vfs::mime_content_type($file));
// Image is already there, but we can’t access them directly through VFS
$ext = $mimetype == ‘application/vnd.oasis.opendocument.text’ ? ‘.odt’ : ‘.ods’;
@@ -471,9 +473,9 @@
// Find mime image, if no tag image set
if(!$tag_image && $mime)
{
-
list($app, $icon) = explode('/', Vfs::mime_icon($mime), 2);
list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'],
— trunk/etemplate/inc/class.vfs_widget.inc.php (original)
+++ trunk/etemplate/inc/class.vfs_widget.inc.php Wed Apr 6 21:39:49 2016
@@ -343,7 +343,7 @@
$thparams[‘mtime’] = $value[‘mtime’];
}
— trunk/phpgwapi/js/jsapi/egw_images.js (original)
+++ trunk/phpgwapi/js/jsapi/egw_images.js Wed Apr 6 21:39:49 2016
@@ -148,7 +148,7 @@
{
var params = { ‘path’: _path, ‘thsize’: this.config(‘link_list_thumbnail’) || 64};
if (_mtime) params.mtime = _mtime;
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs