This simple script will create web thumbnail using cutycapt console command.
I created it to add thumbnails to my bookmarks page.
#!/bin/sh if [ "$#" != "1" ]; then exit fi # Temporary image temp_image="$(tempfile).png" # Output image output_image=`echo $1 | sed s/^www\.//` # First, second and third output_image's letters used for directory creation first_letter=`echo ${output_image} | cut -c1` second_letter=`echo ${output_image} | cut -c2` third_letter=`echo ${output_image} | cut -c3` # Output directory output_directory="thumbnails/${first_letter}/${second_letter}/${third_letter}" cutycapt --url=http://$1 --out=$temp_image convert -resize 120 -crop 120x90+0+0 $temp_image $temp_image mkdir -p $output_directory cp ${temp_image} ${output_directory}/${output_image}.png unlink $temp_image
My bookmarks-thumbnail.inc.tpl.php from SemanticScuttle looks like this:
$url=parse_url($address); $host=preg_replace("/^www\./",'',$url['host']); $image="/thumbnails/". $host[0] . "/" . $host[1] . "/" . $host[2] . "/" . $host . ".png"; if (file_exists($image)) { echo '<img class="thumbnail" onclick="window.location.href=\''.$address.'\'" src="/thumbnails/'. $host[0] . '/' . $host[1] . '/' . $host[2] . '/' . $host . '.png" alt="" /> }
These solutions have a couple of limitations and probably don’t need so many sub-directories, but it will be tuned over time.