Hi Team
I would like to know if there is a reason to not use $conf['picture_ext'] in http://piwigo.org/dev/browser/trunk/adm … ss.php#L76 ?
thx
Offline
by default they are the same ... so by default you can ...
however
- picture_ext is supposed to be displayable in all browsers so i don't know which other format will work ...
- with gd there is no other format implemented in piwigo ...
Offline
Okay Thx!
using the conf will allow the admin to set other image type, of course using a proper IM version and knowing the browsers limitations
This is from a demand for webp support
Offline
flop25 wrote:
This is from a demand for webp support
I saw the request, but I find it completely useless ...
Offline
rvelices wrote:
flop25 wrote:
This is from a demand for webp support
I saw the request, but I find it completely useless ...
that's exactly what I thought when I first read the ticket
But that could open the way to other format like tiff ... they know the requirements and there should be no side effect
But I've heard Pierrick has been implemented on piwigo.com the tiff support: since I don't know what is its change (it's probably an auto convert) I will wait if it can be configurable
Offline
flop25 wrote:
But that could open the way to other format like tiff ... they know the requirements and there should be no side effect
Yes, but this cannot be done just by image_class ...
Today picture_ext is used in three different ways and we need to split it functionnally:
1. the browser can display this extension
2. we can sync metadata (and specifically the important width/height for the derivatives)
3. we can generate a browser visible image (jpg/png...) from this file format
You are addressing only point 3., but 1 and 2 will fail ...
Offline
Here is what I did for TIFF support: create a JPEG or PNG as representative. It only works with ext_imagick :
Index: include/config_default.inc.php
===================================================================
--- include/config_default.inc.php (revision 1322)
+++ include/config_default.inc.php (revision 1323)
@@ -765,4 +765,8 @@
// 'small', 'medium' or 'large'
$conf['derivative_default_size'] = 'medium';
+
+// 'png' or 'jpg': your uploaded TIF photos will have a representative in
+// JPEG or PNG file format
+$conf['tiff_representative_ext'] = 'png';
?>
\ No newline at end of file
Index: admin/themes/default/template/photos_add_direct.tpl
===================================================================
--- admin/themes/default/template/photos_add_direct.tpl (revision 1322)
+++ admin/themes/default/template/photos_add_direct.tpl (revision 1323)
@@ -125,7 +125,7 @@
'auto' : false,
'multi' : true,
'fileTypeDesc' : 'Photo files',
- 'fileTypeExts' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.gif;*.GIF',
+ 'fileTypeExts' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.gif;*.GIF;{/literal}{if $tif_enabled}*.tif;*.TIF;*.tiff;*.TIFF{/if}{literal}',
'fileSizeLimit' : sizeLimit,
'progressData' : 'percentage',
requeueErrors : false,
Index: admin/include/photos_add_direct_prepare.inc.php
===================================================================
--- admin/include/photos_add_direct_prepare.inc.php (revision 1322)
+++ admin/include/photos_add_direct_prepare.inc.php (revision 1323)
@@ -132,6 +132,13 @@
);
$upload_file_types = 'jpeg, png, gif';
+
+if (pwg_image::get_library() == 'ext_imagick')
+{
+ $upload_file_types.= ', tiff';
+ $template->assign('tif_enabled', true);
+}
+
if ('html' == $upload_mode)
{
$upload_file_types.= ', zip';
Index: admin/include/functions_upload.inc.php
===================================================================
--- admin/include/functions_upload.inc.php (revision 1322)
+++ admin/include/functions_upload.inc.php (revision 1323)
@@ -175,6 +175,7 @@
}
$file_path = null;
+ $is_tiff = false;
if (isset($image_id))
{
@@ -230,6 +231,11 @@
{
$file_path.= 'gif';
}
+ elseif (IMAGETYPE_TIFF_MM == $type or IMAGETYPE_TIFF_II == $type)
+ {
+ $is_tiff = true;
+ $file_path.= 'tif';
+ }
else
{
$file_path.= 'jpg';
@@ -248,6 +254,27 @@
}
@chmod($file_path, 0644);
+ if ($is_tiff and pwg_image::get_library() == 'ext_imagick')
+ {
+ // move the uploaded file to pwg_representative sub-directory
+ $representative_file_path = dirname($file_path).'/pwg_representative/';
+ $representative_file_path.= get_filename_wo_extension(basename($file_path)).'.';
+
+ $representative_ext = $conf['tiff_representative_ext'];
+ $representative_file_path.= $representative_ext;
+
+ prepare_directory(dirname($representative_file_path));
+
+ $exec = $conf['ext_imagick_dir'].'convert';
+ $exec .= ' "'.realpath($file_path).'"';
+
+ $dest = pathinfo($representative_file_path);
+ $exec .= ' "'.realpath($dest['dirname']).'/'.$dest['basename'].'"';
+
+ $exec .= ' 2>&1';
+ @exec($exec, $returnarray);
+ }
+
if (pwg_image::get_library() != 'gd')
{
if ($conf['original_resize'])
@@ -324,6 +351,11 @@
$insert['level'] = $level;
}
+ if (isset($representative_ext))
+ {
+ $insert['representative_ext'] = $representative_ext;
+ }
+
single_insert(IMAGES_TABLE, $insert);
$image_id = pwg_db_insert_id(IMAGES_TABLE);Quite simple.
Offline