Announcement

#16 2008-04-03 10:38:59

duncane
Member
2008-04-01
14

Re: Automatic Thumbnails?

i'm gonna work on an update of this script in order to have the thumbs created only if they do not exists.

And i do think if you have a root access, you can run it as a cron task on the web server account, allowing it to run as a cron task.

I will also devel a script that allows you to automaticaly synchronize the database, also runable as a cron task.

This way, you'll just have to ftp your files, and (depending on the cron freq), you'll have them in your galleries :)

I may also think to a daemon version that will take each files on the server as soon as it is uploaded, but i don't know if that's completly possible because if files is created by the ftp server before it is filled with correct data, this solution may not be efficient.

Also warning while runing this on cron tab, the previous comment also apply, if cron task start while you're upploading the files.

Kind Regards,
Duncane

P.S. : if root usage of this script does not work cause of a read permission issue, you could try the following :

replace :

Code:

      $dest_file = $explodedFileName["dirname"] . "/" . $tndir . $tnprefix;
      $dest_file.= $explodedFileName["filename"];
      $dest_file.= "." . $tnextension;

      // creation and backup of final picture
      imagejpeg($destImage, $dest_file);

by :

Code:

      $dest_file = $explodedFileName["dirname"] . "/" . $tndir . $tnprefix;
      $dest_file.= $explodedFileName["filename"];
      $dest_file.= "." . $tnextension;

      // creation and backup of final picture
      imagejpeg($destImage, $dest_file);
      chmod ( $dest_file, 0777 );

it should allow the files to be readable by everyone on the server, including the web-server.

Last edited by duncane (2008-04-03 10:45:17)

Offline

 

#17 2008-04-03 10:49:10

duncane
Member
2008-04-01
14

Re: Automatic Thumbnails?

Lachette wrote:

This is a really nice solution to have, it will even be nicer if/when duncane allows it to run from the root, then i could just run a cron job every hour or so. And yes, it bypasses the timeout issue when doing it via web. most web hosts dont let you jack with the timeout setting anyway so this is a good solution.

the only thing better is if PWG would just generate thumbs as needed. not at the point of adding, but at the point when it needs to be viewed. Gallery2 does this very well but at the same time its bloated with too many other things.

BTW Duncane, thank you so much for this script! Makes doing thumbs for 1000+ pics a breeze.

BTW you test it ? it works correctly ?

Thanks in advance for your feedback.

Cheers :)

@Vdigital : si tu veux une explication en français du pourquoi du comment de ce script, n'hésites pas. En tout cas, celui-ci répond à mon besoin, et à celui de Lachette aussi dirait-on.

Note : si tu veux l'inclure dans la prochaine release de phpwebgallery, je n'y vois aucune objection, j'éssayerais juste d'en faire une version plus propre pour l'occasion qui fasse correctement appel aux fichiers de configurations et aux infos stocker dans la base.

Last edited by duncane (2008-04-03 10:53:11)

Offline

 

#18 2008-04-03 22:24:09

Lachette
Member
2008-03-18
7

Re: Automatic Thumbnails?

I haven't tested it with alot of pictures nor with the recursive one, but with the first one with 100 or so it works well. Im really looking forward to it if you make those other changes!

Last edited by Lachette (2008-04-03 22:35:49)

Offline

 

#19 2008-04-03 22:44:19

duncane
Member
2008-04-01
14

Re: Automatic Thumbnails?

i'm gonna work (when i'll have a few minutes to spend to this) on the feature : do not generate thumbs if they're already existing :)

Offline

 

#20 2008-04-04 22:51:05

duncane
Member
2008-04-01
14

Re: Automatic Thumbnails?

I've just seen a tool while browsing the site that seems to match the need we have :

http://phpwebgallery.net/ext/extension_view.php?eid=150

Or also this one :

http://phpwebgallery.net/ext/extension_view.php?eid=28

Cheers :)

Offline

 

#21 2008-04-04 23:25:30

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Automatic Thumbnails?

Duncane,

It isn't what I call automatic thumbnail...
If you are able to read French, have a look on
Prepare your pictures

8-)


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#22 2008-04-04 23:29:40

duncane
Member
2008-04-01
14

Re: Automatic Thumbnails?

Dear VDigital,

That's true but those script could help, in doing what i'd want :)

But anyway, both do not exactly match the request i have, which is the capacity of syncing a whole set of pics, automatically, without intervention even on the admin web page.

Moreover one of the link is pointing to the tool you have posted on the bottom of the page.

Cheers

Last edited by duncane (2008-04-04 23:30:57)

Offline

 

#23 2008-05-10 17:37:25

quixote
Guest

Re: Automatic Thumbnails?

When all else fails, read the instructions....  I've been fighting with thumbnail creation for a couple of weeks, finally checked the forums, and find the answer has been here all along!

Just in case it can help someone else, or help with the automatic script that would be *wonderful*, here's what I found.

I run Ubuntu (Hardy, 8.04).  Since Imagemagick was already on my system, and came up in a Goodle search as a thumbnail creator ;), I tried using that.  Their site had some suggestions for batch processing thumbnails that didn't entirely work for me.  On a Unix forum there was a way to use a shell script for this.  So, long story short, the following file can be run at a unix/linux command line to generate thumbnails in "thumbnail" subdirectories on the fly.

This uses Imagemagick's "convert" routine to make 160x160 flickr-style square thumbnails with drop shadows.  Unfortunately, it does not name the file correctly ("filename.jpg.png" instead of "TN-filename.png") so I then batch process the filenames.  This would have to be fixed by someone smarter than me!

Code:

find . -type f -name '*.jpg' |\
  while read JPG
  do
    DIR=$(dirname "$JPG")/thumbnail
    THUMBNAIL=$(basename "$JPG").png
    [[ -d "$DIR" ]] || mkdir $DIR
    convert "$JPG" -format png -thumbnail x200 -resize '200x<' -resize 75% -gravity center -crop 160x160+0+0 +repage -page +5+5 -matte \( +clone -background black -shadow 90x5+5+5 \) +swap -background none -mosaic -depth 8 -quality 95 "$DIR/$THUMBNAIL"
  done

Without shadows: leave out everything from "-page +5+5" to "-depth 8".  File size is largish, because quality is at 95.  Could be lower.

Imagemagick has versions for Windows, and the shell script could also be run under Windows using cygwin.

So, anyway, just another approach which can maybe add something to the mix?

 

#24 2008-05-10 17:41:39

quixote
Guest

Re: Automatic Thumbnails?

(Just to add: the way one runs a shell script is you save that code to a file, say "square-thumbs", and then at the command prompt you type "square-thumbs" (without quotes) and hit enter.)

 

#25 2008-05-11 23:13:15

quixote
Member
2008-05-10
95

Re: Automatic Thumbnails?

And another addendum:  PWG wants thumbs smaller than 128x128, so change the numbers accordingly.  (I'm sure there's a way to change the default in the program, but I'm not to that advanced stage yet ....)

Offline

 

#26 2008-05-11 23:35:18

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Automatic Thumbnails?

First install manually "LocalFiles Editor" plugin...
http://phpwebgallery.net/ext/extension_view.php?eid=144


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#27 2009-09-22 18:48:18

fieldguide
Member
2009-08-22
29

Re: Automatic Thumbnails?

I don't think I saw this specifically mentioned in this topic but I would love it if there was an admin option to automatically create missing thumbnails upon a quick sync from the admin area.

I usually add less than 50 pics at a time and I end up having to click more than I'd like to generate the missing thumbs and then sync.

This would be the easiest solution for me.

Thanks!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact