Skip to content

Commit

Permalink
Fixed logging bug
Browse files Browse the repository at this point in the history
  • Loading branch information
renekreijveld committed Mar 3, 2017
1 parent 6544c13 commit 0eb8424
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 9 deletions.
5 changes: 5 additions & 0 deletions source/plg_rsfp_imageresize/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"eventviva/php-image-resize": "1.6.*"
}
}
63 changes: 63 additions & 0 deletions source/plg_rsfp_imageresize/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions source/plg_rsfp_imageresize/rsfpimageresize.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function rsfp_f_onAfterFileUpload($params) {
$lg_height = RSFormProHelper::getConfig('imgresize_lg_height');

// Initialize logging
if ($do_logging == 1)
if ($imgresize_log == 1)
{
jimport( 'joomla.log.log' );
JLog::addLogger(array('text_file' => 'imageupload.' . date('Y-m-d') . '.log.php'), JLog::ALL, array('imageupload'));
Expand All @@ -62,7 +62,7 @@ public function rsfp_f_onAfterFileUpload($params) {
$file = $params['file'];
$name = $params['name'];

if ($do_logging == 1) JLog::add(JText::_('Start processing file ' . $name), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('Start processing file ' . $name), JLog::INFO, 'imageupload');

$upload = pathinfo($file);
$image = new ImageResize($file);
Expand All @@ -72,42 +72,42 @@ public function rsfp_f_onAfterFileUpload($params) {
{
$image->resizeToBestFit($tn_width, $tn_height);
$image->save($upload["dirname"] . '/' . $upload["filename"] . '-tn.' . $upload["extension"]);
if ($do_logging == 1) JLog::add(JText::_('Saved thumbnail version ' . $upload["filename"] . '-tn.' . $upload["extension"]), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('Saved thumbnail version ' . $upload["filename"] . '-tn.' . $upload["extension"]), JLog::INFO, 'imageupload');
}

// Extra small
if (($xs_width > 0 || $xs_height > 0) && $do_xs == 1)
{
$image->resizeToBestFit($xs_width, $xs_height);
$image->save($upload["dirname"] . '/' . $upload["filename"] . '-xs.' . $upload["extension"]);
if ($do_logging == 1) JLog::add(JText::_('Saved extra small version ' . $upload["filename"] . '-xs.' . $upload["extension"]), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('Saved extra small version ' . $upload["filename"] . '-xs.' . $upload["extension"]), JLog::INFO, 'imageupload');
}

// Small
if (($sm_width > 0 || $sm_height > 0) && $do_sm == 1)
{
$image->resizeToBestFit($sm_width, $sm_height);
$image->save($upload["dirname"] . '/' . $upload["filename"] . '-sm.' . $upload["extension"]);
if ($do_logging == 1) JLog::add(JText::_('Saved small version ' . $upload["filename"] . '-sm.' . $upload["extension"]), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('Saved small version ' . $upload["filename"] . '-sm.' . $upload["extension"]), JLog::INFO, 'imageupload');
}

// Medium
if (($md_width > 0 || $md_height > 0) && $do_md == 1)
{
$image->resizeToBestFit($md_width, $md_height);
$image->save($upload["dirname"] . '/' . $upload["filename"] . '-md.' . $upload["extension"]);
if ($do_logging == 1) JLog::add(JText::_('Saved medium version ' . $upload["filename"] . '-md.' . $upload["extension"]), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('Saved medium version ' . $upload["filename"] . '-md.' . $upload["extension"]), JLog::INFO, 'imageupload');
}

// Large
if (($lg_width > 0 || $lg_height > 0) && $do_lg == 1)
{
$image->resizeToBestFit($lg_width, $lg_height);
$image->save($upload["dirname"] . '/' . $upload["filename"] . '-lg.' . $upload["extension"]);
if ($do_logging == 1) JLog::add(JText::_('Saved large version ' . $upload["filename"] . '-lg.' . $upload["extension"]), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('Saved large version ' . $upload["filename"] . '-lg.' . $upload["extension"]), JLog::INFO, 'imageupload');
}

if ($do_logging == 1) JLog::add(JText::_('End RSFP Image Resize'), JLog::INFO, 'imageupload');
if ($imgresize_log == 1) JLog::add(JText::_('End RSFP Image Resize'), JLog::INFO, 'imageupload');

return;

Expand Down
2 changes: 1 addition & 1 deletion source/plg_rsfp_imageresize/rsfpimageresize.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU General Public License version 3</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.renekreijveld.nl</authorUrl>
<version>1.0.0</version>
<version>1.1</version>
<description><![CDATA[PLG_SYSTEM_RSFPIMAGERESIZE_DESC]]></description>
<scriptfile>script.php</scriptfile>

Expand Down

0 comments on commit 0eb8424

Please sign in to comment.