JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 6 forks source link

Recreate images #109

Closed Elfangor93 closed 1 year ago

Elfangor93 commented 1 year ago

This PR adds the functionality to recreate imagetypes (thumbnail, detail, original, ...) based on the current parameters in the config sets. In the Images view there is now in the "images processing" dropdown a button "Recreate". grafik

How to test

AlexanderSupp commented 1 year ago

After recreate of a single image, without changing anything, the original image has the dimensions of the detail image.

MrMusic commented 1 year ago

After recreate of a single image, without changing anything, the original image has the dimensions of the detail image.

Confirmed. After recreate the dimension of the original image is wrong.

Elfangor93 commented 1 year ago

After recreate of a single image, without changing anything, the original image has the dimensions of the detail image.

I can not reproduce this issue.

Can you please take a look into your database and see if in the table #__joomgaller_img_types, the record with typename original has a param called jg_imgtype and it has the value 1 ?

The only reason the script takes the detail image as source for recreation is if this param is missing or has a value different than 1. This would result that the new original image is a copy of the old detail image and would have the same dimension as the detail. This happened to me during testing when this param for mysterious reasons disappeared. Then I had to save the configuration set once more and it worked again as expected.

Elfangor93 commented 1 year ago

The commit #9a6c16e will force to use the original image as the source image even if the corresponding parameter in the database is missing or corrupt. This fix does not really solve the problem since the real problem is the missing or wrong parameter value in the database...

AlexanderSupp commented 1 year ago

I uninstalled JG4 and I installed recreate-imagetypes only. Then I tested with only 2 images. The parm "jg_imgtype":"1" is in detail and in thumbnail, but not in original. See screenshot below. However, now I can't reproduce this error as before. Screenshot 2023-06-18 192818

I will continue my test now. Am I correct in saying that restyling an image doesn't affect the metadata? Or will this data also be newly provided?

AlexanderSupp commented 1 year ago

OK, I tested it. The recording date is not changed. So I assume metadata is fundamentally not restored.

AlexanderSupp commented 1 year ago

I tested the resizing of detail, thumbnails and (Warning) the originals. Also, the watermark. Everything works well. Works as designed. If you change the original and if you have no backup, your photo will never be restored. At this point, a warning make sense. It would be fine if in a later phase the metadata were also recreated. See Issue #90 Anomalies: In the Images screen, the thumbnails displayed with a frame. This doesn't look nice, except you have a square. Just omit the frame. The watermark in a thumbnail is cut.

From my point of view, this PR is ready to merge into main.

MrMusic commented 1 year ago

img_type_database

...This happened to me during testing when this param for mysterious reasons disappeared....

Yes, the parameter is missing in the database record. If the configuration is saved without 'Activate Imagetype' being enabled (sensitive setting), 'jg_imgtype' is lost. If 'Activate Imagetype' was enabled then the value is saved. This only affects the 'original' image type. Maybe it has to do with the fact that it is a sensitive setting? The problem does not occur with newly created image types.

Elfangor93 commented 1 year ago

This only affects the 'original' image type. Maybe it has to do with the fact that it is a sensitive setting?

Yes. Sensitive input fields get the form field attribute disabled which prevent its values beeing submitted: https://stackoverflow.com/questions/1355728/values-of-disabled-inputs-will-not-be-submitted

With the lastest commit, I added code such that jg_imgtype is always retained and even reset if it was once lost.

MrMusic commented 1 year ago

With the lastest commit, I added code such that jg_imgtype is always retained and even reset if it was once lost.

The fix always sets the value to 1. Therefore it is no longer possible to deactivate the 'original' imagetype (Value 0).

MrMusic commented 1 year ago

I have tested this item ✅ successfully. Thank you very much.