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

Fixes related to Gallery image import, watermarks and thumbnails.

This commit is contained in:
CaMer0n
2012-07-14 10:40:40 +00:00
parent 8c497fcee1
commit 4cfe5c4387
12 changed files with 133 additions and 41 deletions

View File

@@ -230,8 +230,8 @@ class media_form_ui extends e_admin_form_ui
foreach($options as $key=>$title)
{
$valW = $curval[$key]['w'];
$valH = $curval[$key]['h'];
$valW = vartrue($curval[$key]['w']);
$valH = vartrue($curval[$key]['h']);
$text .= "<div style='margin-bottomp:8px;text-align:right;width:280px'>".$title.": ";
$text .= "<input class='e-tip' placeholder='ex. 400' style='text-align:right' type='text' name='resize_dimensions[{$key}][w]' value='$valW' size='5' title='maximum width in pixels' /> X ";
@@ -376,7 +376,13 @@ class media_admin_ui extends e_admin_ui
'watermark_text' => array('title'=> 'Watermark Text', 'type' => 'text', 'data' => 'str', 'help'=>'Optional Watermark Text'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_font' => array('title'=> 'Watermark Font', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Optional Watermark Font. Upload more .ttf fonts to the /fonts folder in your theme directory.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_size' => array('title'=> 'Watermark Size', 'type' => 'text', 'data' => 'int', 'help'=>'Size of the font in pts'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_pos' => array('title'=> 'Watermark Position', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Watermark Position'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_margin' => array('title'=> 'Watermark Margin', 'type' => 'text', 'data' => 'int', 'help'=>'The distance that watermark will appear from the edge of the image.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_color' => array('title'=> 'Watermark Color', 'type' => 'text', 'data' => 'str', 'help'=>'Color of the watermark eg. 000000'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_shadowcolor' => array('title'=> 'Watermark Shadow-Color', 'type' => 'text', 'data' => 'str', 'help'=>'Shadow Color of the watermark eg. ffffff '), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'watermark_opacity' => array('title'=> 'Watermark Opacity', 'type' => 'text', 'data' => 'int', 'help'=>'Enter a number between 1 and 100'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
);
@@ -1127,7 +1133,7 @@ class media_admin_ui extends e_admin_ui
$tp = e107::getParser();
$f = e107::getFile()->get_file_info($oldpath,TRUE);
// $mes->addDebug("checkDupe(): newpath=".$newpath."<br />oldpath=".$oldpath."<br />".print_r($upload,TRUE));
$mes->addDebug("checkDupe(): newpath=".$newpath."<br />oldpath=".$oldpath."<br />".print_r($upload,TRUE));
if(file_exists($newpath) || e107::getDb()->db_Select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
{
// $mes->addWarning($newpath." already exists and was renamed during import.");
@@ -1195,7 +1201,7 @@ class media_admin_ui extends e_admin_ui
$mes->add("Scanning for new media (images, videos, files) in folder: ".e_MEDIA."temp/", E_MESSAGE_INFO);
}
if(!count($files))
if(!count($files) && !$_POST['batch_import_selected'])
{
$mes->add("No media Found! Please upload some files and then refresh this page.", E_MESSAGE_INFO);
return;
@@ -1217,8 +1223,8 @@ class media_admin_ui extends e_admin_ui
<th class='center'>".e107::getForm()->checkbox_toggle('e-column-toggle', 'batch_selected')."</th>
<th class='center' style='width:50px'>Preview</th>
<th class='center'>".LAN_FILE."</th>
<th >Title</th>
<th >Caption</th>
<th >Title (internal use)</th>
<th >Caption (seen by public)</th>
<th >Author</th>
<th>Mime Type</th>
<th>File Size</th>
@@ -1232,6 +1238,13 @@ class media_admin_ui extends e_admin_ui
foreach($files as $f)
{
$default = $this->getFileXml($f['fname']);
$f = $fl->cleanFileName($f,true);
if($f['error'])
{
$mes->addWarning($f['fname']." couldn't be renamed. Check file perms.");
}
$text .= "
@@ -1266,7 +1279,7 @@ class media_admin_ui extends e_admin_ui
if(is_readable($waterMarkPath))
{
$text .= $frm->checkbox_label("Add Watermark", 'batch_import_watermark',1);
// $text .= $frm->checkbox_label("Add Watermark", 'batch_import_watermark',1);
}
$text .= "