I've found the bug (just a couple of hours, grrr!!!): mogrify didn't like my relative path to the picture. I let php translate my path into an absolute one; now it works.
function translate($dir) {
global $PATH_TRANSLATED;
$pt=substr($PATH_TRANSLATED,0,strrpos($PATH_TRANSLATED,"/"));
$dir="$pt/$dir";
$dir=str_replace("/./","/",$dir);
$dirs=explode("/",$dir);
for ($i=0;$i<count($dirs);$i++) {
if ($dirs[$i]=="..") {
unset($dirs[$i--]);
if ($i>-1) unset($dirs[$i--]);
};
};
if ($dirs[0]) return "/".implode("/",$dirs); else return implode("/",$dirs);
};
function thumbnail($dir,$file) {
@set_time_limit(2);
//create absolute path for mogrify; ".." doesn't work
$dir=translate($dir);
//Is the file an image anyway?
if (!preg_match("/(\\.jpg|\\.jpeg|\\.gif|\\.png|)$/i",$file)) return false;
//if Thumbnail-Subdir does not exist, create it.
if (!is_dir("$dir/small")) mkdir("$dir/small",0775);
//get original size
$size=getimagesize("$dir/$file");
$ox=$size[0]; $oy=$size[1];
if ($ox and $oy) {
//compute scale (max. width or height = 100)
$scale=min(100/$ox,100/$oy);
//copy original to thumbnaildir
system("cp $dir/$file $dir/small/$file");
//only scale if picture is to large
if ($scale<1) {
//compute resulting size
$dx=intval($ox*$scale);
$dy=intval($oy*$scale);
//mogrify picture and get any messages back in $err
$cmd="/usr/bin/mogrify -format jpeg -geometry $dx"."x$dy $dir/small/$file 2>&1";
$e=exec($cmd);
};
};
};
Thanks for the hint with never used $cmd. Surely it had cost me another hour tomorrow. :-)
Bugi