forked from extern/egroupware
Some Fixes for images view:
-Fix images in listview, clicking on icons does not show the icons in expose view -Fix images always stored as thumbnail and opening them in expose view does not open them in original size -Fix clicking on thumbnail in details tab does not open the fullsize image in expose view
This commit is contained in:
parent
699df9241c
commit
7b7647018d
@ -251,7 +251,17 @@ class resources_bo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$rows[$num]['picture_thumb'] = $this->get_picture($resource, true);
|
$rows[$num]['picture_thumb'] = $this->get_picture($resource, false);
|
||||||
|
if ($rows[$num]['picture_src'] == 'own_src')
|
||||||
|
{
|
||||||
|
// VFS picture fullsize
|
||||||
|
$rows[$num]['picture_original'] = 'webdav.php/apps/resources/'.$rows[$num]['res_id'].'/.picture.jpg';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// cat or generic icon fullsize
|
||||||
|
$rows[$num]['picture_original'] = $this->get_picture($resource, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
|
$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
|
||||||
}
|
}
|
||||||
@ -751,7 +761,7 @@ class resources_bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resizes and saves an pictures in vfs
|
* saves a pictures in vfs
|
||||||
*
|
*
|
||||||
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
||||||
* @param array $file array with key => value
|
* @param array $file array with key => value
|
||||||
@ -777,23 +787,8 @@ class resources_bo
|
|||||||
return lang('Picture type is not supported, sorry!');
|
return lang('Picture type is not supported, sorry!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$src_img_size = getimagesize($file['tmp_name']);
|
|
||||||
$dst_img_size = array( 0 => 320, 1 => 240);
|
|
||||||
|
|
||||||
$tmp_name = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'resources-picture');
|
$tmp_name = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'resources-picture');
|
||||||
if($src_img_size[0] > $dst_img_size[0] || $src_img_size[1] > $dst_img_size[1])
|
|
||||||
{
|
|
||||||
$f = $dst_img_size[0] / $src_img_size[0];
|
|
||||||
$f = $dst_img_size[1] / $src_img_size[1] < $f ? $dst_img_size[1] / $src_img_size[1] : $f;
|
|
||||||
$dst_img = imagecreatetruecolor($src_img_size[0] * $f, $src_img_size[1] * $f);
|
|
||||||
imagecopyresized($dst_img,$src_img,0,0,0,0,$src_img_size[0] * $f,$src_img_size[1] * $f,$src_img_size[0],$src_img_size[1]);
|
|
||||||
imagejpeg($dst_img,$tmp_name);
|
|
||||||
imagedestroy($dst_img);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
imagejpeg($src_img,$tmp_name);
|
imagejpeg($src_img,$tmp_name);
|
||||||
}
|
|
||||||
imagedestroy($src_img);
|
imagedestroy($src_img);
|
||||||
|
|
||||||
egw_link::attach_file('resources',$resouce_id,array(
|
egw_link::attach_file('resources',$resouce_id,array(
|
||||||
@ -822,6 +817,12 @@ class resources_bo
|
|||||||
{
|
{
|
||||||
$picture = egw::link(egw_vfs::download_url($picture));
|
$picture = egw::link(egw_vfs::download_url($picture));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$picture = egw::link('/etemplate/thumbnail.php', array(
|
||||||
|
'path' => $picture
|
||||||
|
));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'cat_src':
|
case 'cat_src':
|
||||||
@ -829,14 +830,14 @@ class resources_bo
|
|||||||
$picture = unserialize($picture['data']);
|
$picture = unserialize($picture['data']);
|
||||||
if($picture['icon'])
|
if($picture['icon'])
|
||||||
{
|
{
|
||||||
$picture = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/images/'.$picture['icon'];
|
$picture = !$fullsize?$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/images/'.$picture['icon']:'/phpgwapi/images/'.$picture['icon'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 'gen_src':
|
case 'gen_src':
|
||||||
default :
|
default :
|
||||||
$src = $resource['picture_src'];
|
$src = $resource['picture_src'];
|
||||||
$picture = $GLOBALS['egw_info']['server']['webserver_url'].$this->resource_icons;
|
$picture = !$fullsize?$GLOBALS['egw_info']['server']['webserver_url'].$this->resource_icons:$this->resource_icons;
|
||||||
$picture .= strpos($src,'.') !== false ? $src : 'generic.png';
|
$picture .= strpos($src,'.') !== false ? $src : 'generic.png';
|
||||||
}
|
}
|
||||||
return $picture;
|
return $picture;
|
||||||
|
@ -505,7 +505,11 @@ class resources_ui
|
|||||||
if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
|
if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);
|
||||||
|
|
||||||
// some presetes
|
// some presetes
|
||||||
$content['resource_picture'] = $this->bo->get_picture($content['res_id'],$content['picture_src'],$size=true);
|
$content['resource_picture'] = $this->bo->get_picture($content['res_id'],false);
|
||||||
|
// Set original size picture
|
||||||
|
$content['picture_original'] = $content['picture_src'] == 'own_src'?
|
||||||
|
'webdav.php/apps/resources/'.$content['res_id'].'/.picture.jpg': $this->bo->get_picture($content['res_id'],true);
|
||||||
|
|
||||||
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
||||||
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
||||||
$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
|
$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
|
||||||
|
@ -67,9 +67,7 @@
|
|||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<description/>
|
<description/>
|
||||||
<vbox>
|
<image src="resource_picture" href="$cont[picture_original]" expose_view="true" align="center"/>
|
||||||
<image src="resource_picture" align="center" />
|
|
||||||
</vbox>
|
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<nextmatch-customfields id="customfields"/>
|
<nextmatch-customfields id="customfields"/>
|
||||||
</row>
|
</row>
|
||||||
<row class="$row_cont[class]">
|
<row class="$row_cont[class]">
|
||||||
<image id="${row}[picture_thumb]" width="100%" expose_view="true" height="auto" extra_link_target="_blank" href="webdav.php/apps/resources/${row_cont[res_id]}/.picture.jpg" src="${row}[picture_thumb]" />
|
<image id="${row}[picture_thumb]" width="100%" expose_view="true" height="auto" href="$row_cont[picture_original]" src="${row}[picture_thumb]" />
|
||||||
<vbox>
|
<vbox>
|
||||||
<description id="${row}[name]" no_lang="1"/>
|
<description id="${row}[name]" no_lang="1"/>
|
||||||
<description id="${row}[short_description]" no_lang="1"/>
|
<description id="${row}[short_description]" no_lang="1"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user