I am using the imagick to create thumbnails of images.
Here is the script:
Code: Select all
function createThumb($id){
$resize=250;
$im= new Imagick();
$basepath="../_resources/_";
$imagesin=$basepath . $id . "/_orignals/";
$imagesout=$basepath . $id . "/_thumbnails/";
$scan=scandir($imagesin);
$p="/^.+\.((jpg)|(jpeg))$/";
for($i=0;$i<count($scan);$i++){
if(preg_match($p,$scan[$i])){
$rfile=$imagesin . $scan[$i];
$ofile=$imagesout . $scan[$i];
if(file_exists($ofile)) continue;
$im->readImage($rfile);
$im->thumbnailImage(250, 0, false);
$im->writeImage($imagesout)
}
}
}
The script is to scan through the directory and check if a similar named file exists in the thumbnail directory and if not then create a thumbnail.
But the problem is instead it just gives a thumb.php on being called.
When i comment out the writeImage part it works fine. I have tries changing the read write permissions of the directory.
i am on ubuntu 8.10 with php 5.2.6 and imagick 2.1.1-rc1.
What do i do?