Skip to content

Instantly share code, notes, and snippets.

@gunjanpatel
Created June 12, 2013 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gunjanpatel/5765018 to your computer and use it in GitHub Desktop.
Save gunjanpatel/5765018 to your computer and use it in GitHub Desktop.
Incorrect thumbnail size (for redSHOP 1.2 or previous releases) fix - Automatic Process
Index: administrator/components/com_redshop/controllers/configuration.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- administrator/components/com_redshop/controllers/configuration.php (revision )
+++ administrator/components/com_redshop/controllers/configuration.php (revision )
@@ -253,8 +253,8 @@
echo $msg = JText::_('COM_REDSHOP_NEWSLETTER_SEND_TO_TEST_EMAIL');
}
- // Thumb folder deleted/created
- if ($post['image_quality_output'] != IMAGE_QUALITY_OUTPUT)
+ // Thumb folder deleted and created
+ if ($post['image_quality_output'] != IMAGE_QUALITY_OUTPUT || $post['use_image_size_swapping'] != USE_IMAGE_SIZE_SWAPPING)
{
$this->removeThumbImages();
}
@@ -278,9 +278,9 @@
}
/**
- * remove all thumbanil
- * for Image quality percentage change variable IMAGE_QUALITY_OUTPUT
+ * Remove all thumbanil images generated by redSHOP
*
+ * @return boolean
*/
public function removeThumbImages()
{
@@ -290,31 +290,28 @@
{
$unlink_path = REDSHOP_FRONT_IMAGES_RELPATH . $thumb_folder[$i] . '/thumb';
- $files = JFolder::files($unlink_path, '.', false, true, array());
-
- if (is_dir($unlink_path))
+ if (JFolder::exists($unlink_path))
{
- if (!empty($files))
- {
- if (JFolder::delete($unlink_path) !== true)
- {
- return false;
- }
- else
- {
- if (JFolder::create($unlink_path) !== true)
- {
- return false;
- }
- else
- {
- $src = REDSHOP_FRONT_IMAGES_RELPATH . 'index.html';
- JFile::COPY($src, $unlink_path . '/index.html');
- }
- }
- }
- }
+ if (JFolder::delete($unlink_path) !== true)
+ {
+ return false;
+ }
+ else
+ {
+ if (JFolder::create($unlink_path) !== true)
+ {
+ return false;
+ }
+ else
+ {
+ $src = REDSHOP_FRONT_IMAGES_RELPATH . 'index.html';
+ JFile::COPY($src, $unlink_path . '/index.html');
+ }
+ }
+ }
+ }
- }
+
+ return true;
}
public function removeimg()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment