#1 2021-02-01 14:51:24

PBENZ404
Member
2021-02-01
15

Redirect from low-res ./galleries directory to a hi-res URL location

Hi,

My photo library was too large so I've converted all 0.7 TB of images to 100x100 pixel photos maintaining the exif data, so that I could happily run the database on my raspberry pi.  I have a duplicate high quality version of all photos using the same file structure on a separate partition. 

The low qualities photos are all kept in ./galleries/, thus all my maps and metadata functions well.

I have a duplicate hi-res directory located at say,  /gallerieshi/.

Is there any way without directly editing the URL to redirect a user to seeing or downloading the high quality version when they click on the low-res 100x100 thumbnail image?

I realise this is a bit of a bespoke request, but I resorted to this approach after trouble with dealing with the hi-res image library.

Best regards, PBENZ404

Offline

 

#2 2021-02-02 19:43:52

PBENZ404
Member
2021-02-01
15

Re: Redirect from low-res ./galleries directory to a hi-res URL location

For what it's worth you can obtain an ugly fix by editing the picture_content.tpl result and adding appropriate symbolic links (ln -s) on a linux system.  If I could figure out how to access the original url rather than the derivative .jpg, I wouldn't need the next set of commands (basically stripping the text of the derivative thumbnails), but at least I can see a route to doing what I want. 


{$strurl=$current.selected_derivative->get_url()}
{$strurl=str_replace( '-me.jpg','',$strurl)}
{$strurl=str_replace( '-th.jpg','',$strurl)}
{$strurl=str_replace( '.jpg','',$strurl)}
{$strurl=str_replace( 'i.','.',$strurl)}
{$strurl=str_replace( '_data/i','',$strurl)}
{$strurl=str_replace( 'php?','',$strurl)}

<img src="./hires/{$strurl}.jpg" width="75%" height="75%"  alt="xyz" id="theMainImage" usemap="#mapOriginal" title="test">

Last edited by PBENZ404 (2021-02-02 22:08:59)

Offline

 

#3 2021-02-02 20:08:18

ckayfish
Member
2021-01-25
53

Re: Redirect from low-res ./galleries directory to a hi-res URL location

About an hour after first installing I realized I didn’t want all the photos on the same disk as the website, so I created symlinks to locations on my media disk for galleries, uploads, and _data. I realize that doesn’t answer your question, but it could be in alternative solution.


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#4 2021-02-02 20:33:13

PBENZ404
Member
2021-02-01
15

Re: Redirect from low-res ./galleries directory to a hi-res URL location

Ckayfish, I think I've gone down a similar route.  I started off with a typical install, but really struggled with checksums taking forever or timeouts.  I realise that in principal Piwigo makes thumbnail derivatives for you, but i think my raspberry pi was too slow for the job.  Eventually, I decided to downgrade the resolution of my whole library after copying it to a separate partition (this command has taken weeks to run, so not surprising that Piwigo struggles!!): 

exiftool  -q -r -ext jpg -if '
    $ImageWidth > 110 ||
    $ImageHeight > 110 and
      !print "$Directory/$Filename\0"' . |
  xargs -r0 sh -c '
    for file do
      mv "$file" "$file.back" &&
        convert -resize "100x100^" "$file.back" "$file" &&
        touch -r "$file.back" "$file" &&
         rm "$file.back"
    done' sh

Then I created symbolic links to the lo-fi/hi-fi galleries directory and I store the files externally to the SD card. The final trick is that while I don't mind having a low-fi database to scan through the files quickly, I do want to be able to access the original high quality version.  I can now do that with a variant of the above.

Work in progress, but quite fun!

Last edited by PBENZ404 (2021-02-02 22:11:05)

Offline

 

Board footer

Powered by FluxBB