Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
bonze
Topic Author
Posts: 3
Joined: 19 Jan 2023, 09:53

Avoiding multiple copies of the same picture

02 Feb 2023, 06:16

Hello !

I tried to search the forum to see if this question was already answered or not but I did not find anything.

I would have a very basic question : Is it possible to display a picture from different folders without uploading it more than once ?

In other words (sorry for my english) I would like some pictures to be part of different albums but without having multiple copies uploaded, is it possible ?
French street photographer
www.laurentfiloche.com
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Avoiding multiple copies of the same picture

02 Feb 2023, 08:11

Hi. Sorry, but this isn't generally possible, because X3 will simply load images that are in the current folder.
  • You can assign "assets" in a gallery to load images from a different folder. This allows a folders images to display in multiple pages. However, you can't select some images from one folder and some from another.
  • You could use "symlinks" in folders that point to images in other folders, but this is a manual process.
  • You can add images from other pages into a page's "content" section, but this is also a manual process.
Something like you request might be possible in a future version with "tags". In this case, you could setup a gallery that loads all images with a specific tag. For now, there is no dedicated feature that allows exactly what you ask. Unless you want to use one of the suggestions above, you would likely be best of simply copying images into folders where you want them to display.
 
User avatar
bonze
Topic Author
Posts: 3
Joined: 19 Jan 2023, 09:53

Re: Avoiding multiple copies of the same picture

02 Feb 2023, 08:51

Thanks for the quick reply.

I think this feature makes really sense because it is related to global datacenter footprint. And it is a bit odd to store and pay for useless redundant copies.

It looks like that symbolic links would be the most appropriate way to do that but I'm not sure how to create them in my hosted web space. I'm going to check.
French street photographer
www.laurentfiloche.com
 
User avatar
bonze
Topic Author
Posts: 3
Joined: 19 Jan 2023, 09:53

Re: Avoiding multiple copies of the same picture

02 Feb 2023, 10:25

Quick update : I only have an FTP access to my data and the protocol does not allow to create symbolic links.

The gallery with tagged images would be an excellent idea.
French street photographer
www.laurentfiloche.com
 
metallissimus
Experienced
Posts: 331
Joined: 17 Oct 2019, 06:54

Re: Avoiding multiple copies of the same picture

02 Feb 2023, 11:14

I have an idea for a hacky workaround, but I don't know if it could work:

Concept:
I have a folder ("originals") with my image files and a folder ("copy") that has pure white images* with the same names and dimensions.

If it is possible to write some JS in the copy folder that changes this
Code
<img data-src="/content/copy/image-1.jpg" data-width="1920" alt="Image 1" itemprop="thumbnail" src="/render/w480/copy/image-1.jpg">
to this
Code
<img data-src="/content/originals/image-1.jpg" data-width="1920" alt="Image 1" itemprop="thumbnail" src="/render/w480/originals/image-1.jpg">
 I assume it should work?

I found a general direction here: https://stackoverflow.com/questions/132 ... javascript

So something roughly like this:
Code
var images = document.getElementsByTagName("img");

for (var i = 0; i < images.length; i++) {
    data-temp = images[i].data-src
   images[i].data-src = data-temp.replace(originals, copy)
   src-temp = images[i].src
   images[i].src = src-temp.replace(originals, copy)
}
It's probably evident I am not a coder and I don't know JS, but I hope it's enough to make my idea comprehensible.

* a pure white or black JPG with 1920x1280px, quality 0 and MozJpeg compression comes in around 12kB. This was the smallest file sized dummy solution I could think of. At first I wanted to use a 1x1px image but I guess then the src path to the render file would make no sense.
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Avoiding multiple copies of the same picture

02 Feb 2023, 21:14

metallissimus wrote: I have an idea for a hacky workaround, but I don't know if it could work:
It would work, but I really can't recommend it.

All this manual setup and creation of "empty" files with matching names, is it worth it just to save a few MB? Storage is so cheap now, our own service flamepix.com offers "unlimited storage" (within reasonable boundaries), and any host that charges too much for storage is really not a great host. In this case, your idea is just more time-consuming that simply copying the original files into the location where you want them to display.

Besides, in this Javascript, you are simply replacing images from one folder to another ... It does not support images from multiple folder. And in that case, why not just use X3 gallery "assets" which loads images from one folder in another folder, without copying them. Also, this javascript setup is not optimal ... It would likely load the white images first, so the page will be loading twice as many images as it needs, although the file size is minimal.
 
metallissimus
Experienced
Posts: 331
Joined: 17 Oct 2019, 06:54

Re: Avoiding multiple copies of the same picture

03 Feb 2023, 04:05

mjau-mjau wrote: Besides, in this Javascript, you are simply replacing images from one folder to another ... It does not support images from multiple folder. And in that case, why not just use X3 gallery "assets" which loads images from one folder in another folder, without copying them.
Haha, I was so excited about the idea that I completely missed that! Of course my "solution" doesn't solve anything...
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography