diff --git a/admin/include/configuration_watermark_process.inc.php b/admin/include/configuration_watermark_process.inc.php index 2beaa19b1..676056300 100644 --- a/admin/include/configuration_watermark_process.inc.php +++ b/admin/include/configuration_watermark_process.inc.php @@ -29,6 +29,30 @@ if( !defined("PHPWG_ROOT_PATH") ) $errors = array(); $pwatermark = $_POST['w']; +// step 0 - manage upload if any +if (isset($_FILES['watermarkImage']) and !empty($_FILES['watermarkImage']['tmp_name'])) +{ + list($width, $height, $type) = getimagesize($_FILES['watermarkImage']['tmp_name']); + if (IMAGETYPE_PNG != $type) + { + $errors['watermarkImage'] = 'PNG'; + } + else + { + $upload_dir = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'watermarks'; + + include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); + prepare_directory($upload_dir); + + $new_name = get_filename_wo_extension($_FILES['watermarkImage']['name']).'.png'; + $file_path = $upload_dir.'/'.$new_name; + + move_uploaded_file($_FILES['watermarkImage']['tmp_name'], $file_path); + + $pwatermark['file'] = substr($file_path, strlen(PHPWG_ROOT_PATH)); + } +} + // step 1 - sanitize HTML input switch ($pwatermark['position']) { diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index 10210428a..08bd97593 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -33,7 +33,7 @@ jQuery(document).ready(function(){

{'Piwigo configuration'|@translate} {$TABSHEET_TITLE}

{if !isset($default)} -
+ {/if}
{if isset($main)} @@ -479,20 +479,28 @@ jQuery(document).ready(function() { jQuery("#positionCustomDetails").hide(); } }); + + jQuery(".addWatermarkOpen").click(function(){ + jQuery("#addWatermark, #selectWatermark").toggle(); + }); }); {/literal}{/footer_script} -
  • - + {* #selectWatermark *} + + {'add a new watermark'|@translate} (png) +
    + {if isset($ferrors.watermarkImage)}!{/if} +
    {* #addWatermark *}
  • diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index d85dab084..2e7c25643 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -1112,4 +1112,5 @@ FORM#categoryOrdering .categoryLi:hover p.albumActions {visibility:visible;} input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;} .dErrorDesc {background-color:red; color:white; padding:0 5px;border-radius:10px; font-weight:bold;cursor:help;} -#wImg {max-height:100px;border:2px solid #ccc;} \ No newline at end of file +#wImg {max-height:100px;border:2px solid #ccc;margin-top:5px;} +#addWatermark {display:none;} \ No newline at end of file