Did you know that you can set max-width and max height for image uploads (and edited/resized images) in the action/resize plug-in?
If you set one or both of those parameters, your concern is probably not primarily the size in pixel but the resulting bytes.
As no quality parameters are set, the resulting file size in bytes most often is much larger than the original upload. Of course depending on the size and the compression of the original.
Set quality parameters for jpeg and png files when resizing with PHP.
I have edited and tested code and can make a PR, if you agree to the issue.
Labels |
Added:
?
|
Can someone point me where is the PR with compression (=quality) parameters schnuti wanted to submit? Or is it abandoned or is schnuti still working on it?
Please add the file renaming code to the image editing plugin.
I used to write myself a plugin J3 for renaming uploaded photos.
So that test editors and creators of unique content don't have problems with photo names when they suddenly have the same file name.
To prefix the file name with the date and material ID.
So that everything happens automatically.
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Plugin\CMSPlugin as JPlugin;
class plgSystemImageRename extends JPlugin {
public function __construct(&$subject, $config=array())
$image_rename = $this->params->get("image_auto_rename",FALSE);
if(empty($image_rename)) return;
$this->input = JFactory::getApplication()->input;
$files2 = $this->input->files->get('Filedata', array(), 'array');
if(empty($files2) && empty($_FILES['Filedata'])) return;
if(is_array($_FILES['Filedata']['name'])){// && isset($file['name'])
foreach ($_FILES['Filedata']['name'] as $i => &$file)
$_FILES['Filedata']['name'][$i] = $this->getNewName($_FILES['Filedata']['name'][$i]);
}
elseif(is_string($_FILES['Filedata']['name'])){
$_FILES['Filedata']['name'] = $this->getNewName($_FILES['Filedata']['name']);
}
if(empty($files2)) return;
if(isset($files2['name'])){
$files2['name'] = $this->getNewName($files2['name']);
}
elseif (isset($files2[0]['name'])) {
foreach ($files2 as $i => &$file)
$file['name'] = $this->getNewName($file['name']);
}
}
public function getNewName($str = ''){
$image_date_rename = $this->params->get("image_date_rename",FALSE);
$image_format_rename = $this->params->get("image_format_rename","Ymd_");
if($image_date_rename == 2 && $image_format_rename)
$str = date($image_format_rename).$str;
elseif($image_date_rename)
$str = date("Ymd_").$str;
$str = str_replace(' ', '_', $str);
$str = str_replace('-', '_', $str);
$str = JFactory::getLanguage()->transliterate($str);
return $str;
}
}
Please don't mix different issues. You have posted your request already at #28792 (comment) . This issue here is about quality settings for resized images.
Thank you
Labels |
Added:
?
No Code Attached Yet
Removed: ? |
can be a good feature