1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-30 01:30:32 +02:00

Image watermarking plugin added to PHPThumbs and added as import option.

This commit is contained in:
CaMer0n
2011-08-23 02:51:56 +00:00
parent 4bc7f70dbd
commit 9e7eeffe6d
2 changed files with 138 additions and 3 deletions

View File

@@ -576,10 +576,24 @@ class media_admin_ui extends e_admin_ui
</tbody>
</table>
<div class='buttons-bar center'>
Import into Category: ".$frm->selectbox('batch_category',$this->cats)."
Import into Category: ".$frm->selectbox('batch_category',$this->cats);
$waterMarkPath = e_THEME.e107::getPref('sitetheme')."/images/watermark.png";
if(is_readable($waterMarkPath))
{
$text .= $frm->checkbox_label("Add Watermark", 'batch_import_watermark',1);
}
$text .= "
</div>
<div class='buttons-bar center'>
".$frm->admin_button('batch_import_selected', "Import Selected Files", 'import')."
".$frm->admin_button('batch_import_selected', "Import Selected Files", 'import');
$text .= "
</div>
</fieldset>
</form>
@@ -609,6 +623,17 @@ class media_admin_ui extends e_admin_ui
require(e_HANDLER.'phpthumb/ThumbLib.inc.php'); // For resizing on import.
list($img_import_w,$img_import_h) = explode("x",e107::getPref('img_import_resize'));
if(vartrue($_POST['batch_import_watermark']))
{
$WM = TRUE;
$watermarkPath = e_THEME.e107::getPref('sitetheme')."/images/watermark.png";
$watermark = PhpThumbFactory::create($watermarkPath);
}
else
{
$WM = FALSE;
}
foreach($_POST['batch_selected'] as $file)
{
@@ -626,9 +651,19 @@ class media_admin_ui extends e_admin_ui
catch (Exception $e)
{
$mes->addError($e->getMessage());
continue;
// return $this;
}
$thumb->resize($img_import_w,$img_import_h)->save($oldpath);
if($WM) // TODO Add watermark prefs for alpha and position.
{
$thumb->resize($img_import_w,$img_import_h)->addWatermark($watermark, 'rightBottom', 30, 0, 0)->save($oldpath);
}
else
{
$thumb->resize($img_import_w,$img_import_h)->save($oldpath);
}
}
// End Resize routine. ---------------------