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 -Clicking on thumbnail in details tab, will open the image in a popup with its original size
This commit is contained in:
parent
e92028da65
commit
8caca5580c
@ -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])
|
imagejpeg($src_img,$tmp_name);
|
||||||
{
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
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,13 @@ 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,
|
||||||
|
'thheight' => 128,
|
||||||
|
));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'cat_src':
|
case 'cat_src':
|
||||||
@ -829,14 +831,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,8 @@ 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);
|
||||||
|
$content['picture_original'] = $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;
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
</grid>
|
</grid>
|
||||||
<description/>
|
<description/>
|
||||||
<vbox>
|
<vbox>
|
||||||
<image src="resource_picture" align="center" />
|
<image src="resource_picture" href="$cont[picture_original]" extra_link_popup="600x480" extra_link_target="_blank" align="center" />
|
||||||
</vbox>
|
</vbox>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
|
@ -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