I can create thumbnails just after I upload an image, but to create them from files which are already on the server is not an easy job.
The code that I am trying to use is as follows..
$uploadDir = "/home/charlie/domains/lonelycastleart.com/public_html/images/" . $qry[artist_name];
$search = $qry[artist_name] . "/";
$image = str_replace($search, "", $qry2[img_location]);
$image_path = $uploadDir;
$thumb_path = $uploadDir . "/thumbs";
$image_name = $image;
$src = $domain . "images/" . $qry[artist_name] . "/" . $image_name;
$thumb_width = 150;
$src_img = imagecreatefromjpeg("$src");
$origw = imagesx($src_img);
$origh = imagesy($src_img);
$new_w = $thumb_width;
$diff = $origw/$new_w;
$new_h = $origh/$diff;
$dst_img = imagecreatetruecolor($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "$thumb_path/$image_name", 100);
This code is actually working all right to create the image successfully, but the problem is that I am unable to actually view the image. I can browse via FTP and see that the image exists, and I can then download it onto my computer and view it and it's fine, but I can't access via the web server; I'm also unable to edit the permissions of the files created. I have no idea why this is happening and I haven't really any idea how to fix it. If anyone has an idea what is causing this or a solution, please let me know as this is such an annoying problem
Thanks a lot,
Patrick