1 (edited by petax 2023-03-25 14:24:22)

Topic: Mystery reorder of images part 2 - Updating only the images

Okay

I have uploaded my gallery using the Lightroom plugiin, but I realise (for example) that I forgot to put my watermark on them.

I thought I would be a smart arse and reuplaod my gallery, having made the change (to my outside of ShowKase upload directory as you recommended). I copied just the images, and replaced the images in the 'large' directory and rebuilt the gallery, so far so good. New images are displayed.

BUT.. the order has changed!

Now, I would have just uploaded and replaced the entire gallery, BUT... I have spent a while adding witty titles and so on in showKase online (as there is understandably no way I can see to do that in Lightroom, and save it, feel free to tell me I am wrong, I am all ears).

So here is the question, all I have changed is the images, they all work perfectly so the names are clearly correct. The captions etc are still there, I can view the big versions no problem. BUT the order has changed!

What do you think Steve? I mean, that's life I get it, but curious don't you think?

Re: Mystery reorder of images part 2 - Updating only the images

Hmm.. I don't know what the image order was previously and I don't know what it is now (alphabetical, date order, random) so it's hard for me to know what might be happening.

I'm a little unclear as to all the steps you've taken to get your new images into your existing gallery.
Is there any chance you could list everything you did in order so that I can better understand the situation?
e.g.
(1) Re-uploaded 'large' images to an already imported gallery's source folder.
(2) Re-imported gallery to obtain a new imported gallery (with new images).
(3) Copied all image size files from the new imported gallery to the original imported gallery's 'images' directory.
(4) Deleted the new imported gallery (which was only created to generate new images in all sizes) via Showkase's interface (on the 'Pages' tab).

I'm not sure if this is exactly what you've done.
If it is, then I can't explain why the image order would have changed. The gallery's XML file which holds all the image data (including image order) would not have been modified.

With regard to image titles and captions, you could maybe embed them within your images as IPTC metadata so that the titles and captions are part of the images themselves and they travel with the images. Wherever the images go, their titles and captions go, too. Showkase can extract IPTC metadata (a limited subset but enough for titles and captions) for use as titles and captions. You can instruct Showkase to extract the IPTC title and/or IPTC description for all images at once.

Please see 'Editing Individual Captions' in the Pages section of the Showkase User Guide for details on how to extract the image's IPTC title and description.

There are some special codes that can be entered into titles, captions and descriptions:
{iptctitle} causes Showkase to look for embedded iptc metadata in the image and insert the contents of the title field if present.
{iptcdescription} is translated into the iptc description field if present.

If entering IPTC data via Adobe Photoshop, {iptctitle} corresponds to the IPTC 'Document Title' field and {iptcdescription} corresponds to the IPTC 'Description' field. I expect these labels will be the same for Lightroom (but I'm not 100% sure).

Re: Mystery reorder of images part 2 - Updating only the images

Hi Steve,
Thanks for your reply.

The simple answer is that I replaced (successfully) the large images, in the large images folder in the existing gallery.

Then I rebuilt the gallery using the rebuild gallery option in that gallery (see screen shot).

For clarity on my last post, for ease of use I used Lightroom to upload the gallery to a 'staging' upload directory outside the showkase root directory, as you recommended in previous advice. Then transferred by hand just the images from there to the large directory. I needed to rebuild the gallery to generate the small and medium images, as discussed Lightroom does not do that.

I used ftp to put the images in the 'large' directory/folder. Very simple operation. This was a correlation, but not the causation, it is a red herring as it makes no difference, see below.

------

Okay:

  • As an experiment, I have uploaded the a test gallery from light room so it is a new page., and I can go through it step by step with you.

  • I have imported it following the instructions from the my 'gallery_uploads' directory (which as I have said is. not in the root directory of showkase)

  • I added my captions etc

  • I have published the gallery

  • The images are in the same order as they were in Lightroom

  • I have rebuilt the page/gallery having made no changes what so ever to anything in showkase, nor on the server

  • The order of the images has changed

  • I have rebuilt AGAIN the gallery having made no changes what so ever to anything

  • The order of the images has changed again

  • I have rebuilt once more the gallery having made no changes what so ever to anything

  • The order of the images has changed again

  • it appears to be randomising the images on each rebuild.

  • I have checked in customise viewer and Pro Viewer Options to make sure that randomise images is not checked, and it is not, and never has been, I like to choose my own order of images to tell a story. ;-)

  • The page content is carried over, this is what I wanted to preserve, as have the captions etc, but the image order has changed thank for your advice on captions but I miss spoke. I will being using captions on images as you suggested in due course thank you. You didn't waste your time.

For the record, I love showkase, I love the fact that it is XML driven, to the extent that I have got a new hosting account which is much faster, just so I can really enjoy it without the restrictions of the crappy snail slow host I was using before.
I draw this to your attention as it is a odd bug. I hope that I have explained clearly what I have done, and how you should be able to replicate it.

I have reinstalled showkase as you advised, and I am working on a staging server at this moment. As far as I can tell it is an uncorrupted install. But after I have posted, I am going to reinstall it one more time and redo my tests to see if it makes any difference. If it does I will post below.

Thanks as always for your kind help and support.

Post's attachments

Screenshot 2023-03-24 at 11.05.48.png 197.75 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Mystery reorder of images part 2 - Updating only the images

Well...

I updated the showKase with a freshly unzipped copy.

I rebuilt the gallery 'test for steve' and I am afraid that the order of the images changed again.

Here is the original order as uploaded by Lightroom, and imported by Showkase
(sorry the screen shots a bit large, but I have to go to a meeting, I will fix that later if I have time.)
https://luengogaztelu.com/showkase/Screenshot%202023-03-24%20at%2012.46.42.png


Here are three screen shots of image orders after three rebuilds, I notice that the thumbnails have changed ?!

https://luengogaztelu.com/showkase/Screenshot%202023-03-24%20at%2012.24.08.png
https://luengogaztelu.com/showkase/Screenshot%202023-03-24%20at%2012.24.30.png
https://luengogaztelu.com/showkase/Screenshot%202023-03-24%20at%2012.24.50.png

Re: Mystery reorder of images part 2 - Updating only the images

Thanks for the detailed description and screenshots.
So, in a nutshell, the issue is 'Pages -> Edit Page -> Advanced -> Rebuild' changes the images order (to a different order each time).

Here's my best guess at what's going on...

It certainly seems odd that a random image order would be obtained each time the gallery is rebuilt.
There's definitely no forced randomization going on (as far as I know) so my best guess is that the new image generation may be a multi-threaded process on the web server and Showkase adds each image to the gallery when its image generation is completed.
Multi-threading would certainly get the job done faster than a one-by-one sequential process and you can always sort the images afterwards on the Sort tab.
I don't know for sure if that's what's going on but it would be a possible explanation.

Incidentally, I'm pretty sure rebuilding a gallery was intended as a repair process (e.g. to reconstruct a corrupt XML file) rather than part of a gallery's import procedure.

You seem to have a good grasp of how Showkase works, though, so I hope you can find the workflow that works best for you.

Re: Mystery reorder of images part 2 - Updating only the images

Hi Steve,

Just out of curiosity, the first time I had the problem
(https://showkase.net/forum/viewtopic.php?id=473)
with the Mystery Reorder of images it was on an apache server.

This current one is on a Lightspeed server.

It would really great if you could produce a 'script' that just regenerates the images.

Re: Mystery reorder of images part 2 - Updating only the images

I've been trying to reproduce the problem you've described (rebuilding the gallery results in a random image order) but I've been unable to (on an Apache server).

I imported a Juicebox-Pro gallery with a custom image order and Showkase successfully imported the gallery and retained the custom image order and image titles and captions.

An initial 'Pages -> Edit Page -> Advanced -> Rebuild' rebuilt the gallery and changed the image order (to filename order) but retained image titles and captions.
All subsequent 'Pages -> Edit Page -> Advanced -> Rebuild' actions did not change anything at all.

I see your screenshots and don't doubt what you are experiencing but I don't know what's causing it.
I guess we're both using the same version of Showkase (v1.7.6) and you mentioned that you've seen the problem on an Apache server (which I was also using for testing) so other variables are the PHP installation/settings and the import gallery.

The import gallery shouldn't make a difference but if you like, you could send me the gallery (zip the gallery, upload the zip file somewhere and provide a link) and I'll try rebuilding it several times to see what happens. We should then perhaps be able to eliminate this from the equation (which would leave just PHP installation/settings as the main difference between your setup and mine).

My initial thought (regarding multi-threading) could still be possible but it's really difficult to troubleshoot an issue I can't reproduce.
I hope you can work around it.

It would really great if you could produce a 'script' that just regenerates the images.

Thank you for posting your request in the Feature Requests thread. I'm not the author of Showkase but the your request will definitely be seen by the developers over there.

Re: Mystery reorder of images part 2 - Updating only the images

What ho Steve,

Thanks for your reply, firstly this is a curiosity not a deal breaker. I am surprised given that we are both using the same build that it is not replicable at your end. I have one comment on this:

An initial 'Pages -> Edit Page -> Advanced -> Rebuild' rebuilt the gallery and changed the image order (to filename order) but retained image titles and captions.
All subsequent 'Pages -> Edit Page -> Advanced -> Rebuild' actions did not change anything at all.

To fully replicate the issue, you need to upload a gallery from Lightroom, import it. Then having made no changes to anything at all, rebuild the gallery using 'Pages -> Edit Page -> Advanced -> Rebuild'. I do not use the sort feature in showcase, the screen shots were to show you the order, I have not actioned any 'sort by' options.

I sort my images in Lightroom, the thumbnails in ShowKase are too small to work with. (Same goes on the images page. I wish the previews were bigger there, easier to work with.)

It must be to do with the Lightroom plugin, I will have a look see if there are any options for sort. I don't recall any.

I would be happy to make a zip file for you to test out, do you want me to email you the link, I don't see any PM option on here.

I'll give you the directory structure, including the Lightroom upload for you to import, so you can do the whole thing.

I'd go as far as to give you login on my staging server if you like.

I'll make that zip file.

9 (edited by petax 2023-03-26 13:53:11)

Re: Mystery reorder of images part 2 - Updating only the images

Hi Steve

I have sent you an email with everything you need. Access to a staging server custom built just for you, with a clone of the showkase install. You have full access in every respect. If you can't replicate the bug on that, I will be astonished, as I have just tested it and the reorder happens exactly as reported. You are free to do whatever you want.

Also a download link to the zip of the gallery if you want to test it on your own server as well. I would appreciate it if you delete it all when you have finished.

Remember this has happened on my old apache server and this one which is Lightspeed (not sure what the difference is).

I haven't launched the gallery to the public as yet, still a work in progress.

I look forward to hearing from you, please confirm that you received the email.

Thanks

Re: Mystery reorder of images part 2 - Updating only the images

Email received. Thank you!

Thank you very much for all the effort you've gone to in documenting this issue.

After some extensive testing, I've been able to reproduce the problem and I've now seen this happen with not only galleries built with Lightroom but also with JuiceboxBuilder and Showkase itself.

It seems to be more noticeable in large galleries (e.g. 100 images or more) and happens more often than not when 'Site -> Customize Viewers -> Juicebox-Pro 1.5.1 -> Edit -> Pro Viewer Options -> Multi-size Images (Pro) -> Medium image resize' is selected (in conjunction with a change to 'Max width' and/or 'Max height').

Being that the image order after each 'Rebuild' seems random and that it seems to be more noticeable in large galleries (where there are a lot of images to process), it still looks like a result of multi-threading to me (with a lot of images being processed concurrently and not always finishing in the same order) but at least I've now got enough information to log a bug report with the developers (which I've just done).

Even if multi-threading is at the root of the problem, it would almost certainly be faster than sequential processing of images so it's likely to remain. Maybe the answer would be to re-order the images (perhaps to a default setting, e.g. filename order) after each rebuild which would be preferable to a random order. I'll leave it in the hands of the developers.

Re: Mystery reorder of images part 2 - Updating only the images

Hi Steve,

Thanks for confirming that I am not going insane, and for your kind attention.

I've will delete the server in due course, feel free to keep my galleries for as long as you need them.

I would really like to push for a regenerate images only option on rebuild, for more advanced users such as myself. As the image names don't change in any of the directories (Large, Small and Images root), there is no need to update the XML (etc) files.

As a stop gap work around, I have just zipped up the following files in my test gallery.
config.xml
index.html
images.txt
page.xml
preferences.txt

After rebuilding my gallery, I have just unzipped them to over write the new versions, and bingo the sort order is restored.

This is useful to me, but I expect few people will have my issue. I just had a gallery with no watermarks on it, and wanted to only upload the changed pictures, rather than reimport the gallery and start from scratch. Given the amount of time spent on this, I may as well have, lol!!

I have no doubt messing about with the showkase directories and content is generally a very bad idea and is frowned upon, but this gets the job done for me. I don't expect to be doing it very often.

----

As a matter of interest, your multi-tread explanation does seem to fit. I couldn't replicate the problem on shared hosting today, I guess that it was not busy or alternatively it was too busy, perhaps affecting the speed that images were processed (pure speculation).

cheers for now

Re: Mystery reorder of images part 2 - Updating only the images

After rebuilding my gallery, I have just unzipped them to over write the new versions, and bingo the sort order is restored.

Good thinking! That'll work.

As a matter of interest, your multi-tread explanation does seem to fit. I couldn't replicate the problem on shared hosting today...

Yes, this theory does seem to make sense.

I have no doubt messing about with the showkase directories and content is generally a very bad idea and is frowned upon...

Not frowned upon... just not officially supported.
Having said that, if you really want a button to regenerate only images and don't want to create one yourself (I don't know how many source files would be involved) or wait to see if the developers introduce one, then you could maybe re-purpose the existing 'Rebuild' button to process only images by commenting out the lines of code which deal with regenerating the accompanying text files.

A couple of caveats:
(1) You'd no longer be able to use the 'Rebuild' button for its original purpose/full functionality.
(2) It would work only if no images are added to or removed from the gallery and if all filenames remain exactly the same. (I know you are aware of this. It's worth mentioning again, though, just in case anyone else is reading this.)

With this in mind, if you want to try it out, open your site's admin/commands/advanced.php file in a plain text editor and comment out (or remove) lines 77 to 86 (inclusive) and also lines 88 and 89. You can comment out lines of PHP code by adding // at the beginning, as follows:

// $page->gallery->saveGallery();
// Board::addMessage('Gallery xml file rebuilt');
// $pageSet->setPagesDataImageCount(
    // $pageIndex,
    // $page->getImageCount()
// );
// $pageSet->savePagesData();
// $pageSet->setPagesPref('publishing', 'unpublished');
// $pageSet->savePagesPrefs();
// Board::addMessage('Page data cache updated');
// $page->savePageHtml($pageSet, new Nav($pageFactory, $pageSet), new GalleryIndex($pageSet), new Smarty());
// Board::addMessage('Page html rebuilt');

Just re-upload the file after editing it (to its original location, overwriting the existing file). You might like to make a backup of the original file first (although you could always just extract the stock version of the file from the Showkase zip file if you need it).

This is untested and, being a source code modification, as far as I can take this in my capacity as official support.
I hope it points you in the right direction, though.

Re: Mystery reorder of images part 2 - Updating only the images

Thanks Steve,

That is excellent, I will give it a try out and let you know how is goes. I appreciate you can't support it, but I do like getting under the hood!

Thank you, much appreciated.

all the best :-)

Re: Mystery reorder of images part 2 - Updating only the images

You're welcome!

Re: Mystery reorder of images part 2 - Updating only the images

I have two buttons!
https://luengogaztelu.com/showkase/Screenshot%202023-03-28%20at%2022.45.53.png

I've not hacked PHP in years, thanks for pointing me in the right direction. It has been thoroughly tested, works like a charm.

-------

As a matter of interest. I have discovered that in a showkase gallery with only one 'page' the mystery resort does not happen.

In a showkase gallery with lots of pages, it happens every time. Even though the other pages are not involved, other than being there. How that fits with the multithreading concept I have no idea.
-------

Steve, if you want to test out the new buttons the steve test server and gallery is still up and running access details the same, but due to the fewer pages the sort issue does not replicate.

I will email you the hacked files, just so you have them. No support expected at all. That was a fun challenge, thanks again for facilitating it.

Re: Mystery reorder of images part 2 - Updating only the images

I have two buttons!

Nice! I'm glad you've got the functionality you need.
Thanks for the update.