mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Media-Manager batch image-rotation added (only jpeg for now). Other minor tweaks.
This commit is contained in:
@@ -129,7 +129,7 @@ class media_cat_ui extends e_admin_ui
|
||||
'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1','readonly'=>FALSE), // Display name
|
||||
'media_cat_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
|
||||
'media_cat_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'right', 'class'=> 'right' ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
);
|
||||
|
||||
function init()
|
||||
@@ -203,6 +203,14 @@ class media_form_ui extends e_admin_form_ui
|
||||
$this->cats[$cat] = $row['media_cat_title'];
|
||||
}
|
||||
asort($this->cats);*/
|
||||
|
||||
if(varset($_POST['multiselect']) && varset($_POST['e__execute_batch']) && (varset($_POST['etrigger_batch']) == 'options__rotate_cw' || varset($_POST['etrigger_batch']) == 'options__rotate_ccw'))
|
||||
{
|
||||
$type = str_replace('options__','',$_POST['etrigger_batch']);
|
||||
$ids = implode(",",$_POST['multiselect']);
|
||||
$this->rotateImages($ids,$type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function resize_method($curval)
|
||||
@@ -218,6 +226,43 @@ class media_form_ui extends e_admin_form_ui
|
||||
return $frm->selectbox('resize_method',$options,$curval)."<div class='field-help'>".IMALAN_4."</div>";
|
||||
}
|
||||
|
||||
private function rotateImages($ids,$type)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$degrees = ($type == 'rotate_cw') ? 270 : 90;
|
||||
|
||||
// $mes->addDebug("Rotate Mode Set: ".$type);
|
||||
|
||||
//TODO GIF and PNG rotation.
|
||||
|
||||
if($sql->db_Select("core_media","media_url","media_id IN (".$ids.") AND media_type = 'image/jpeg' "))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$original = $tp->replaceConstants($row['media_url']);
|
||||
|
||||
$mes->addDebug("Attempting to rotate by {$degrees} degrees: ".basename($original));
|
||||
|
||||
$source = imagecreatefromjpeg($original);
|
||||
|
||||
$rotate = imagerotate($source, $degrees, 0);
|
||||
$srch = array(".jpg",".jpeg");
|
||||
$cacheFile = str_replace($srch,"",strtolower(basename($original)))."_(.*)\.cache\.bin";
|
||||
|
||||
if(imagejpeg($rotate,$original,100))
|
||||
{
|
||||
$mes->addSuccess("Rotated: ".basename($original));
|
||||
e107::getCache()->clearAll('image',$cacheFile);
|
||||
$mes->addDebug("Clearing Image cache with mask: ".$cacheFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resize_dimensions($curval) // ie. never manually resize another image again!
|
||||
{
|
||||
$text = "";
|
||||
@@ -255,7 +300,7 @@ class media_form_ui extends e_admin_form_ui
|
||||
// $text .= $frm->text("resize_dimensions[{$key}]",$val, 5, array('size'=>'5')).$title."<br />";
|
||||
}
|
||||
|
||||
$text .= "<div><br />Warning: This feature is experimental.</div>";
|
||||
// $text .= "<div><br />Warning: This feature is experimental.</div>";
|
||||
|
||||
return $text;
|
||||
|
||||
@@ -263,9 +308,22 @@ class media_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
|
||||
function options()
|
||||
function options($parms, $value, $id)
|
||||
{
|
||||
//return print_a($_GET,true);
|
||||
if($value == 'batch')
|
||||
{
|
||||
return array(
|
||||
"rotate_cw" => "Rotate 90° cw",
|
||||
"rotate_ccw" => "Rotate 90° ccw"
|
||||
);
|
||||
}
|
||||
|
||||
if($_GET['action'] == 'edit')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$tagid = $_GET['tagid'];
|
||||
$path = $this->getController()->getListModel()->get('media_url');
|
||||
$title = $this->getController()->getListModel()->get('media_name');
|
||||
@@ -275,7 +333,15 @@ class media_form_ui extends e_admin_form_ui
|
||||
$bbcode = ($_GET['bbcode']=='file') ? "file" : "";
|
||||
// $save = ($_GET['bbcode']!='file') ? "e-dialog-save" : "";
|
||||
// e-dialog-close
|
||||
return "<input type='button' value='Select' class='e-media-select e-dialog-save e-dialog-close' data-id='{$id}' data-name=\"".$title."\" data-target='{$tagid}' data-bbcode='{$bbcode}' data-path='{$path}' data-preview='{$preview}' title=\"".$title."\" />";
|
||||
$text = $this->renderValue('options',$value,'',$id);
|
||||
|
||||
if($_GET['action'] == 'dialog')
|
||||
{
|
||||
$text .= "<input type='button' value='Select' class='e-media-select e-dialog-save e-dialog-close' data-id='{$id}' data-name=\"".$title."\" data-target='{$tagid}' data-bbcode='{$bbcode}' data-path='{$path}' data-preview='{$preview}' title=\"".$title."\" />";
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +426,7 @@ class media_admin_ui extends e_admin_ui
|
||||
'media_tags' => array('title'=> "Tags/Keywords", 'type' => 'text', 'data'=> 'str', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ),
|
||||
'media_usedby' => array('title'=> '', 'type' => 'text', 'data'=> 'text', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'nolist'=>true, 'readonly'=>TRUE ),
|
||||
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data'=> null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'data'=> null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center', 'batch'=>true, 'noedit'=>true)
|
||||
);
|
||||
|
||||
|
||||
|
@@ -1916,7 +1916,7 @@ class admin_newspost
|
||||
<tr>
|
||||
<td>".NWSLAN_12.":</td>
|
||||
<td>
|
||||
<input type='text' name='news_title' value=\"". $tp->post_toForm($_POST['news_title'])."\" class='tbox' style='width:90%' />
|
||||
<input type='text' name='news_title' value=\"". $tp->post_toForm($_POST['news_title'])."\" class='tbox' style='width:90%' required='required' />
|
||||
".
|
||||
// TOO short -> $frm->text('news_title', $tp->post_toForm($_POST['news_title']),200,array('size'=>300)).
|
||||
"
|
||||
|
@@ -37,13 +37,18 @@ if(e_AJAX_REQUEST && isset($_GET['src'])) // Ajax
|
||||
echo 'There was a problem retrieving the file';
|
||||
exit;
|
||||
}
|
||||
// chmod(e_PLUGIN,0777);
|
||||
chmod(e_UPLOAD.$localfile,0755);
|
||||
|
||||
require_once(e_HANDLER."pclzip.lib.php");
|
||||
$archive = new PclZip(e_UPLOAD.$localfile);
|
||||
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666));
|
||||
|
||||
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0755));
|
||||
// chmod(e_PLUGIN,0755);
|
||||
$dir = basename($unarc[0]['filename']);
|
||||
|
||||
// chmod(e_UPLOAD.$localfile,0666);
|
||||
|
||||
|
||||
|
||||
/* Cannot use this yet until 'folder' is included in feed.
|
||||
if($dir != $p['plugin_folder'])
|
||||
{
|
||||
@@ -65,17 +70,20 @@ if(e_AJAX_REQUEST && isset($_GET['src'])) // Ajax
|
||||
e107::getDb()->db_Select_gen("SELECT plugin_id FROM #plugin WHERE plugin_path = '".$plugPath."' LIMIT 1");
|
||||
$row = e107::getDb()->db_Fetch(MYSQL_ASSOC);
|
||||
$status = e107::getSingleton('e107plugin')->install_plugin($row['plugin_id']);
|
||||
unlink(e_UPLOAD.$localfile);
|
||||
//unlink(e_UPLOAD.$localfile);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print_a($unarc);
|
||||
$status = "There was a problem";
|
||||
// print_a($fileList);
|
||||
$status = "Error: <br /><a href='".$remotefile."'>Download Manually</a>";
|
||||
//echo $archive->errorInfo(true);
|
||||
// $status = "There was a problem";
|
||||
//unlink(e_UPLOAD.$localfile);
|
||||
}
|
||||
|
||||
echo $status;
|
||||
@unlink(e_UPLOAD.$localfile);
|
||||
|
||||
// echo "file=".$file;
|
||||
exit;
|
||||
@@ -95,6 +103,12 @@ require_once(e_HANDLER.'file_class.php');
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
require_once (e_HANDLER.'message_handler.php');
|
||||
|
||||
if(isset($_POST['uninstall_cancel']))
|
||||
{
|
||||
header("location:".e_SELF);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$plugin = new e107plugin;
|
||||
$pman = new pluginManager;
|
||||
@@ -1209,10 +1223,14 @@ class pluginManager{
|
||||
</tr>
|
||||
</table>
|
||||
<div class='buttons-bar center'>";
|
||||
|
||||
$text .= $frm->admin_button('uninstall_confirm',EPL_ADLAN_3,'submit');
|
||||
$text .= $frm->admin_button('uninstall_cancel',EPL_ADLAN_62,'cancel');
|
||||
|
||||
/*
|
||||
$text .= "<input class='button' type='submit' name='uninstall_confirm' value=\"".EPL_ADLAN_3."\" />
|
||||
<input class='button' type='submit' name='uninstall_cancel' value='".EPL_ADLAN_62."' onclick=\"location.href='".e_SELF."'; return false;\"/>";
|
||||
|
||||
*/
|
||||
// $frm->admin_button($name, $value, $action = 'submit', $label = '', $options = array());
|
||||
|
||||
$text .= "</div>
|
||||
|
@@ -282,7 +282,7 @@ $text .= "<div class='field-spacer'>".$tp->parseTemplate("{IMAGESELECTOR={$parms
|
||||
|
||||
$sLogo = siteinfo_shortcodes::sc_logo();
|
||||
|
||||
echo $sLogo;
|
||||
//echo $sLogo;
|
||||
// $frm->imagepicker('sitelogo',$pref['sitelogo'],'_common')
|
||||
|
||||
|
||||
|
@@ -3675,6 +3675,11 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$val = "'".$value."'";
|
||||
}
|
||||
|
||||
if($field == 'options') // reserved field type. see: admin -> media-manager - batch rotate image.
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$cnt = $this->getTreeModel()->update($field, $val, $selected, $value, false);
|
||||
if($cnt)
|
||||
{
|
||||
|
@@ -272,11 +272,9 @@ class ecache {
|
||||
* @example clearAll('db');
|
||||
*/
|
||||
|
||||
function clearAll($type)
|
||||
{
|
||||
|
||||
function clearAll($type,$mask = null)
|
||||
{
|
||||
$path = null;
|
||||
$mask = null;
|
||||
|
||||
if($type =='content')
|
||||
{
|
||||
@@ -299,13 +297,13 @@ class ecache {
|
||||
if($type == 'db')
|
||||
{
|
||||
$path = e_CACHE_DB;
|
||||
$mask = '*.php';
|
||||
$mask = ($mask == null) ? '*.php' : $mask;
|
||||
}
|
||||
|
||||
if($type == 'image')
|
||||
{
|
||||
$path = e_CACHE_IMAGE;
|
||||
$mask = '*.cache\.bin';
|
||||
$mask = ($mask == null) ? '*.cache\.bin' : $mask;
|
||||
}
|
||||
|
||||
if((null == $path) || (null == $mask))
|
||||
@@ -315,7 +313,7 @@ class ecache {
|
||||
|
||||
$fl = e107::getFile(false);
|
||||
$fl->mode = 'fname';
|
||||
$files = $fl->get_files($path, $fmask);
|
||||
$files = $fl->get_files($path, $mask);
|
||||
if($files)
|
||||
{
|
||||
foreach ($files as $file)
|
||||
|
Reference in New Issue
Block a user