Auteur Topic: Snellere thumbnail creatie in DSM4.2  (gelezen 1581 keer)

Offline ReneNas

  • Bedankjes
  • -Gegeven: 0
  • -Ontvangen: 2
  • Berichten: 13
Snellere thumbnail creatie in DSM4.2
« Gepost op: 18 december 2013, 21:26:22 »
*** dit script werkt NIET op oudere DSM versies! en niet getest op DSM4.3!!! ***

Ik vond op engelse en duitse forums manieren om de thumbnails sneller te laten maken door oudere DSM-versies.
Voor DSM 4.2 vond ik echter geen werkende manier. Ik heb nu na wat veranderen en combineren van gevonden scripts dit aan het werk gekregen op de volgende manier:
Het kan vast handiger of beter, maar onderstaande methode werkt iig.

waarschuwing! Je moet wel weten wat je doet als je in het systeem aan de gang gaat!



telnet 192.168.1.100 (je nas-adres)
vi /usr/syno/bin/convert-thumb-nosharpen.sh
(press i) and paste code:

#!/usr//bin/perl -w
@newargs = (); # Where we are going to copy the arguments
$doLnk = 0;     # Flag meaning that we can generate a symbolic link to the original file
$t640 = 0;      # Flag meaning we create the 640 thumb now
$t320 = 0;      #
$t120 = 0;      #
$copyPath = ""; # The path where we are generating the thumbnails. It comes in the registry:temporary-path parameter

for $arg(@ARGV) {
 #Detect the folder of the thumbnails
 if($arg =~ m/^registry.temporary.path./) {
  $copyPath = $arg;
  $copyPath =~ s/^registry.temporary.path.//;
 }
 elsif($arg eq "1280x1280"){ $doLnk = 1; } # XL
 elsif($arg eq "800x800"){ $doLnk = 1; }   # L
 elsif($arg eq "640x640"){ $t640 = 1; }  # B
 elsif($arg eq "320x320"){ $t320 = 1; }  # M
 elsif($arg eq "120x120"){ $t120 = 1; }  # S
 elsif($arg eq "-size") { $arg = "-sample"; } #
 push @new_args, $arg;
}

#We change the source to the XL sized picture to save reading time.
if($t640){
 $new_args[$#new_args-1] = $copyPath . "/SYNOPHOTO:THUMB_XL.jpg";
}

#We change the source to the B sized picture to save reading time.
if($t320){
 $new_args[$#new_args-1] = $copyPath . "/SYNOPHOTO:THUMB_B.jpg";
}

#We change the source to the B sized picture to save reading time.
if($t120){
 $new_args[$#new_args-1] = $copyPath . "/SYNOPHOTO:THUMB_B.jpg";
}

#We make a symbolic link when ever it applies
if($doLnk){
 exec "ln", ("-sf", $ARGV[$#ARGV-1], $ARGV[$#ARGV]);
}else{

# Nothing more to do... lets get the thumbnail!

# my $timestamp = localtime(time);
# open (MYFILE, '>>/volume1/web/thumbnail.log');
# print MYFILE $timestamp , " ";
# print MYFILE @new_args;
# print MYFILE "\n";
# close (MYFILE);
exec "/usr/syno/bin/convert", @new_args;
}

(save and exit)
[esc]:wq

(voor de zekerheid de rechten goed zetten:)
chmod 755 /usr/syno/bin/convert-thumb-nosharpen.sh

(backup! the standard symbolic link convert-thumb before proceeding:)
(De map 'public' moet dus wel een bereikbare (hoofd-)map op je nas zijn)
cp /usr/syno/bin/convert-thumb /volume1/public/convert-thumb-backup

(make a symlink / activate the script (this changes the standard symbolic link convert-thumb to point to our script:)
chmod +x /usr/syno/bin/convert-thumb-nosharpen.sh
ln -sf /usr/syno/bin/convert_nosharpen.sh /usr/syno/bin/convert-thumb

vi /usr/syno/etc.defaults/thumb.conf (and thumb_high.conf)
    [thumb 120]
    phase=2
    size=120
    quality=70
    filename=SYNOPHOTO:THUMB_S.jpg

    [thumb 320]
    phase=1
    size=640
    quality=80
    filename=SYNOPHOTO:THUMB_B.jpg

    [thumb 640]
    phase=2
    size=320
    quality=50
    filename=SYNOPHOTO:THUMB_M.jpg

    [thumb 800]
    phase=2
    size=800
    quality=70
    filename=SYNOPHOTO:THUMB_L.jpg

    [thumb 1280]
    phase=0
    size=1280
    quality=90
    filename=SYNOPHOTO:THUMB_XL.jpg
(save and exit:)
[esc]:wq

(thumb 640 en 320 zijn gewisseld om de volgorde van bewerken goed te krijgen, thumb 320 wordt nu namelijk gemaakt uit thumb 640, ipv steeds de basisfile te gebruiken)

(reload the service:)
/usr/syno/etc/rc.d/S77synomkthumbd.sh restart

En vanaf nu worden de thumbnails veeel sneller gemaakt!
Tot je weer een upgrade doet natuurlijk...


 

Stabiele en snellere uploadsnelheid

Gestart door StramroodBoard FTP, NFS and Samba Server

Reacties: 4
Gelezen: 2513
Laatste bericht 22 augustus 2008, 09:33:38
door mdferket
'Snellere' backup van 918+ naar 110j, remote!

Gestart door André PE1PQXBoard Data replicator & overige backupsoftware

Reacties: 10
Gelezen: 1126
Laatste bericht 15 april 2020, 20:14:56
door André PE1PQX
Snellere backup

Gestart door beetofBoard Aankoopadvies

Reacties: 8
Gelezen: 2103
Laatste bericht 27 december 2016, 09:02:31
door Hofstede
Snellere Workflow

Gestart door gb1995Board Netwerk algemeen

Reacties: 21
Gelezen: 3634
Laatste bericht 27 februari 2018, 09:27:36
door André PE1PQX