rejetto forum

Software => HFS ~ HTTP File Server => Beta => Topic started by: rejetto on August 02, 2020, 03:53:07 PM

Title: thumbnails
Post by: rejetto on August 02, 2020, 03:53:07 PM
i've found that extracting the thumbnail that's sometimes embedded in a jpeg can be easy with a method that's probably not 100% reliable but took me little work.
I'm going to introduce this new feature even if the default tpl will not make use of it for now.
It can be considered experimental.
The feature works like this: you append ?mode=thumb to the url of a jpg file.
The thumbnail itself is served as a file. If not available you'll get a 404.
Generating a thumbnail is of course much worse on the CPU and poses some serious concerns: store it? and where?
It may be introduced in the future, but it's not a quick job as the one i just did.

You'll find it in the RC7 i'm going to release soon.
Title: Re: thumbnails
Post by: dj on August 02, 2020, 05:47:41 PM
I recommend to store it in a subfolder thumb on Upload (similar mobillight).
I will write the addon, when I'm Back from Holidays.
Title: Re: thumbnails
Post by: dj on August 07, 2020, 10:33:28 AM
show (https://github.com/dj0001/hfs-template/blob/master/addons/Jpgimgthumb_S.diff.tpl) the Server generated thumbnails (for now without saving)



jpgimgthumb_Store.diff.tpl works only with mobillight for now
I can't get the 'load' macro to run with images
Title: Re: thumbnails
Post by: rejetto on August 10, 2020, 10:02:12 PM
I can't get the 'load' macro to run with images

i don't understand what you meant
Title: Re: thumbnails
Post by: dj on August 11, 2020, 12:15:46 AM
I tried it first server side.

{.load|smallpic.jpg|var=mytext.}
{.save|test.jpg|var=mytext.}

test.jpg is saved, but not readable (format not supported)
Title: Re: thumbnails
Post by: Mars on August 11, 2020, 09:41:49 AM
what you would like are macros like "load bin" and "save bin" using a buffer variable

load and save only deal with text files, and besides this can create some problems when used with different encoding formats (ansi utf8 utf16 ...)
Title: Re: thumbnails
Post by: rejetto on August 11, 2020, 01:01:36 PM
just as mars said.
if you need them to make cool stuff we can add them.
Title: Re: thumbnails
Post by: danny on August 19, 2020, 08:40:55 AM
...
The feature works like this: you append ?mode=thumb to the url of a jpg file.
The thumbnail itself is served as a file. If not available you'll get a 404...
Can you change to If not available then send whole jpg file?

This piece is missing?:  I wonder if there is a 3rd party thumbnail generator, which could add thumbnails into the jpgs without re-encoding the original photo data?  If that was available and commandline, then @sunday exec thumbgen.bat.  Hopefully it could skip jpgs which already contain thumbnail data.

In this case, 'thumbgen.bat' can run multithread by
start "" "my.exe" -c start-minimized=yes -c active=yes
So, hfs, exec doesn't have to wait on it to finish (For Windows 7,8,8+1,10, by using start, then a batch file can end in a couple of milliseconds).
Title: Re: thumbnails
Post by: dj on August 19, 2020, 09:03:53 AM
Can you change to If not available then send whole jpg file?

uncomment line14 in show (https://github.com/dj0001/hfs-template/blob/master/addons/Jpgimgthumb_S.diff.tpl#L14) the Server generated thumbnails
or use this (http://rejetto.com/forum/index.php?topic=11754.msg1066366#msg1066366) code
Title: Re: thumbnails
Post by: rejetto on August 23, 2020, 09:52:04 AM
Can you change to If not available then send whole jpg file?

surely it would not be the main behavior, as not everybody would want that.
For the time being you should handle the 404 and request the whole picture if you want.