I need a help about ImageMagick for creating thumbnail images.
The website that I create is hosted on Godaddy.com hosting service with PHP5.
And I use ImageMagick for create thumbnail.
Here is the code I use for creating thumbnail.
Directory to save uploaded files
$save_dir = "../ProductImage";
ImageMagick Directory
$ImageMagick_Dir = "/usr/local/bin";
for ($i=0; $i<=8; $i++) {
if (is_uploaded_file($_FILES[img][tmp_name][$i])) {
// Convert file name
list ($_FILES[img][name][$i],$ext) = explode(".",$_FILES[img][name][$i]);
$time = time() + $i;
$rename[$i] = array($time,"jpg");
$reImage[$i] = implode(".",$rename[$i]);
// Directory name and file name to save
$dest = $save_dir . "/" . $reImage[$i];
// Save file to the directory
if (!move_uploaded_file($_FILES[img][tmp_name][$i], $dest)) {
die("Fail to save files to the directory.");
}
// Convert file size
chmod ("$save_dir/$reImage[$i]", 0644);
if ($reImage[0]) {
exec ("$ImageMagick_Dir/convert -thumbnail 130x130 -crop 130x130+0+0 -bordercolor white -border 50 -gravity center $save_dir/$reImage[$i] $save_dir/Thumb/List_$reImage[$i]");
}
exec ("$ImageMagick_Dir/convert -thumbnail 72x72 -crop 72x72+0+0 -bordercolor white -border 50 -gravity center $save_dir/$reImage[$i] $save_dir/Thumb/$reImage[$i]");
exec ("$ImageMagick_Dir/convert -thumbnail 300x300 -crop 300x300+0+0 -bordercolor white -border 100 -gravity center $save_dir/$reImage[$i] $save_dir/$reImage[$i]");
}
}
Could you guys can find what is wrong with this code for me?
Because I'm using this code for creating thumbnail on more than three different websites but it doesn't work only one website with exactly same code.
Other website, works perfect and no problem so far.
Those websites are hosted on Godaddy.com but different server.
Also the code, sometimes working sometimes not. (I really don't understand this point.)
I asked to Godaddy.com support but they only saying, ImageMagick is works fine.
I really couldn't find what's wrong with this code.
Please help me out over here.
Thanks.