collapse

* User Info

 
 
Welcome, Guest. Please login or register.

* Recent Posts

Forum closed by whazzup
[September 25, 2021, 02:56:14 PM]


How do i replace an image file with another image file by Malu
[December 16, 2020, 03:17:02 PM]


Can't get RSG "Show My Galleries" to work by Dampfnudel
[February 25, 2019, 11:01:55 AM]


Change the order of uploaded images in the gallery by whazzup
[February 19, 2019, 10:37:29 PM]


Upload timeout for large galleries (500 images each) by whazzup
[February 11, 2019, 10:07:25 PM]


Greetings from Ronald Smit by whazzup
[January 06, 2019, 03:39:22 PM]


Pluign and module by whazzup
[June 08, 2018, 11:57:13 PM]


Version 4.4.1 released by whazzup
[May 31, 2018, 04:31:16 PM]

Author Topic: [Bug: watermarked img not removed] Thumb clicks through to incorrect image  (Read 7654 times)

Offline scene66

  • Newbie
  • *
  • Posts: 49
Hi RSG2 — happy new year!

I have a gallery displayed correctly with correct thumbs. When each thumb is clicked a different (incorrect) image appears.

The gallery in question is: http://scenestr.com.au/index.php?option=com_rsgallery2&gid=463

• I have tried MAINTENANCE> OPTIMISE DATABASE without success.
• I have tried MAINTENANCE> CONSOLIDATE DATABASE, which does find errors with other files, which don't appear to be rectifiable, but not relevant to this gallery.
• I have tried phpMyAdmin and repaired and optimised RS2 tables.
• The ITEMS are correct when inspected via RSGALLERY2> MANAGE ITEMS.

Could the issue be duplicate file names?

Joomla 2.5
RSGallery 3.2.0
PHP 5.3.27
MYsql 5.1.72

Regards
scene66
« Last Edit: January 08, 2014, 02:34:50 PM by mirjam »

Offline scene66

  • Newbie
  • *
  • Posts: 49
Re: Thumb clicks through to incorrect image
« Reply #1 on: January 06, 2014, 07:20:12 AM »
It appears a number (all?) our galleries have been affected intermittently. Here's another example:
http://scenestr.com.au/index.php?option=com_rsgallery2&gid=465

Offline whazzup

  • Dev Team
  • Sr. Member
  • *****
  • Posts: 270
Re: Thumb clicks through to incorrect image
« Reply #2 on: January 06, 2014, 04:22:49 PM »
Hello Brisbane
A happy new year to you too scene66 and a better start then above

When looking and clicking at your thumbnails i see filenames like 2-3.jpg. I remember that if you have the same picture name when uploading RSG2 will rename it to *-1.jpg. In the example above this is the fourth file 2.jpg which you uploaded.

Can you detect a special behaviour between picutres requested and pictures displayed ?

Example:
* Picture to be displayed 1-2.jpg Coming up is 12.jpg

? Did you use always the upload or insert some pictures by hand.
* Can you check if you have files with blanks in the name like "123 .jpg"

I do chec kin of pictures in the following sequence
Every picture of one event will be copied in one folder. Then i use FastStone Photo Resizer to get all in the same sime. Inside the process in activated the rename function which extracts the date and time and gives me names like 2013-12-19_00001, 2013-12-19_00002 .... I get sometimes pictures from more than one person (or if you have more than one event on a day)  then i can add some characters more inside Phote Resizer. I seldom change this string but use a "Total commander" function to add some characters to a selection of files. As i resize my big photos anyway it is not more work then before and i get unique file names.

Sorry i am not able to help you more deeper but i am working on it.

Regards from Whazzup, remembering stormy days in brisbane and frasers island
If you are looking for the newest version of  RSGallery2 for Joomla 3 please check out https://github.com/RSGallery2

Offline scene66

  • Newbie
  • *
  • Posts: 49
Re: Thumb clicks through to incorrect image
« Reply #3 on: January 06, 2014, 11:53:50 PM »
Hi Wazzup

Thank you for speedy reply. Stormy? We've just had a heck of a storm between my post and yours! Following a month of beautiful Queensland weather :D

We use Photoshop to prepare the images (Photoshop Batch Resize Function). We don't pay any attention to the file names. Mostly the files are uploaded at the same time, but occassionally we add a few images after the main upload. Always using the RSG2 Batch Upload function.

With what you have said, plus my guess, I'm sure it's a file naming protocol issue. Is there a way to rename files (original, thumb etc.) once they have been uploaded? I have attached a screenshot in case you are able to direct me using that.

Cheers
scene66

Offline scene66

  • Newbie
  • *
  • Posts: 49
Re: Thumb clicks through to incorrect image
« Reply #4 on: January 07, 2014, 01:41:58 AM »
I should add that the incorrectly displayed images are from different galleries from the correctly displayed thumbs.

Offline mirjam

  • Retired from Dev Team
  • Hero Member
  • ****
  • Posts: 670
Re: Thumb clicks through to incorrect image
« Reply #5 on: January 07, 2014, 08:21:56 PM »
Duplicate file names are not (should not?) be possible. Files are renamed like whazzup mentions. At least that is the case for the simple set of ten test files I always use multiple times ;-)

You are not using any SEF, which is also important to know.

On page http://scenestr.com.au/index.php?option=com_rsgallery2&gid=463 I tried the 6th image, the image is
http://www.scenestr.com.au/images/rsgallery/thumb/22.jpg.jpg
but it links to http://scenestr.com.au/index.php?option=com_rsgallery2&page=inline&id=19358 with image
http://www.scenestr.com.au/images/rsgallery/watermarked/display8f2202b8f2f355ff354893f068643f54.jpg which is a watermarked image.

Let's try to identify if that is the issue.

The watermarked images with their filenames are created in a class called waterMarker (used Notepad++ to search for "class watermark") in the file \admin\includes\img.utils.php where files from the \admin\ folder in the zip go to the \JOOMLAROOT\administrator\components\com_rsgallery\ folder on the site when installed). In its function showMarkedImage the watermarked image filename is created.

I have tried on my own site (J2.5, RSG2 3.2.0, PHP5.3.3, MySQL5.5, no SEF) and cannot recreate your issue. So I've copied an image to make sure I have image.jpg and image-1.jpg, but those images display correctly as well.

Could you try to empty you watermarked images folder, by default it is in /JOOMLAROOT/images/rsgallery/watermarked/. RSG2 makes the watermarked images "on the fly" when an image is first accessed. Its flaw is that is does not remove such images, now that I'm thinking about it, when an image is removed an a new and different image is uploaded with the same name as an old image. So RSG2 won't recreate the watermarked image.

You can test this by removing
http://www.scenestr.com.au/images/rsgallery/watermarked/display8f2202b8f2f355ff354893f068643f54.jpg (watermarked image showing up when smiling person with hat is clicked on at http://scenestr.com.au/index.php?option=com_rsgallery2&gid=463).
Or (better) by renaming the watermarked folder and then creating a new emtpy watermarked folder ;-) thus keeping your watermarked images if this was now the problem but also "removing" all watermarked images for the system to see.
With a little boy in the house I don't spend as much time on RSG2 anymore.

I still like RSG2, if you do too, please think about how you can invest some of your time in RSG2... the one remaining coding volunteer (Whazzup) can use your help!

Offline mirjam

  • Retired from Dev Team
  • Hero Member
  • ****
  • Posts: 670
Re: Thumb clicks through to incorrect image
« Reply #6 on: January 07, 2014, 09:13:44 PM »
In addition to the above:

Maintenance - optimise database does exactly what the phpMyAdmin optimise function does.

Consolidate database tries to find "orphan" image files and missing disply/thumb images and offers the option to create the latter.

Watermarks are only applied to display and original images not to thumbs.

File that are uploaded cannot be renamed within RSG2. If you know what you are doing you could hack the database, e.g. change the filename, etc. but I'd then prefer to remove the item, rename the file and upload it again.

If the above is the issue then RSG2 should check for the existance of a watermarked image when removing an item and then also remove that watermarked image (both display and original). Or perhaps, as a temporary solution, compare the watermarked file time stamp and the upload date of the item (#__rsgallery2_files table date column, where #__ is the database prefix, e.g. jos_) and recreate the watermarked image when necessary.
This would be done in the function removeImages in \administrator\components\com_rsgallery\options\images.php where subsequently the images are deleted from the filesystem and the item is deleted from the database.
With a little boy in the house I don't spend as much time on RSG2 anymore.

I still like RSG2, if you do too, please think about how you can invest some of your time in RSG2... the one remaining coding volunteer (Whazzup) can use your help!

Offline scene66

  • Newbie
  • *
  • Posts: 49
Re: Thumb clicks through to incorrect image
« Reply #7 on: January 08, 2014, 01:09:41 AM »
You are not using any SEF, which is also important to know.
I neglected to mention that I am using sh404SEF. My apologies as I have neglected to mention this in another thread.

Quote from: mirjam
Let's try to identify if that is the issue.

Could you try to empty you watermarked images folder, by default it is in /JOOMLAROOT/images/rsgallery/watermarked/. RSG2 makes the watermarked images "on the fly" when an image is first accessed. Its flaw is that is does not remove such images, now that I'm thinking about it, when an image is removed an a new and different image is uploaded with the same name as an old image. So RSG2 won't recreate the watermarked image.

You can test this by removing
http://www.scenestr.com.au/images/rsgallery/watermarked/display8f2202b8f2f355ff354893f068643f54.jpg (watermarked image showing up when smiling person with hat is clicked on at http://scenestr.com.au/index.php?option=com_rsgallery2&gid=463).
Or (better) by renaming the watermarked folder and then creating a new emtpy watermarked folder ;-) thus keeping your watermarked images if this was now the problem but also "removing" all watermarked images for the system to see.
Bingo! I renamed the watermark folder and created a new one named watermark. This issue is fixed. For others trying this, the usual word of caution regarding browser cache: it wasn't initially clear that this solution worked because after 'the fix', some old, incorrect images appeared, but that was solely due to browser cache. Testing on different browsers which hadn't before 'seen' the error and clearing the browser cache proved the proved issue fixed.

You guys are "THE BEST"! Thank you wazzup and mirjam. Hot dog!

Offline whazzup

  • Dev Team
  • Sr. Member
  • *****
  • Posts: 270
Hi scene66,

Now that we know how to repair the wrong behaviour when deleting files which are watermarked the next step is to prevent the error in the future. Appended are two files where when the original file is deleted and the matching watermarked files are deleted too.

Files to be replaced
...\administrator\components\com_rsgallery2\includes\img.utils.php
...\administrator\components\com_rsgallery2\options\images.php

Please backup the files before overwriting or better backup the complete site. The watermarked files should be deleted again to make sure that in the mean time no further leftover form deleting will survive.

The files will also be included in the next release of course

Have success
Regards from whazzup
If you are looking for the newest version of  RSGallery2 for Joomla 3 please check out https://github.com/RSGallery2

Offline scene66

  • Newbie
  • *
  • Posts: 49
Thanks Whazzup

Files replaced as per above. Watermarked folder renewed as suggested. Trialed deleting some old galleries. All appears to be working fine.

Thank you for your support.