This is a discussion on XP read/write problem (I guess) within the alt.comp.lang.php forums, part of the PHP Programming Forums category; <?php $handle = opendir('covers'); $filename=0; while (false !== ($filename = readdir($handle))) { $str=str_replace(".jpg", "", $filename); ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
<?php
$handle = opendir('covers'); $filename=0; while (false !== ($filename = readdir($handle))) { $str=str_replace(".jpg", "", $filename); if (is_numeric($str)) //all pics are of the digitdigitdigit.jpg style { $size = getimagesize("./covers/$filename"); $src_width = $size[0]; $src_height = $size[1]; $dest_height = 100; $dest_width = $dest_height*$src_width/$src_height; $src_img = imagecreatefromjpeg("./covers2/$filename"); $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, "./thumbs/$filename"); imagedestroy($src_img); imagedestroy($dst_img); } } ?> 1) Does this thumbing function look ok for its purpose? 2) If I echo $filename at each loop, I see the function DOES scan all my jpg files but no thumb is created I tried to attrib -R my folders, to no avail :'S Any leads or pointers? Thanks, Sebastian |
|
|||
|
"pouzzler" a écrit le 14/12/2003 :
> <?php > $handle = opendir('covers'); > $filename=0; > while (false !== ($filename = readdir($handle))) > { > $str=str_replace(".jpg", "", $filename); > if (is_numeric($str)) //all pics are of the digitdigitdigit.jpg > style [...] > 2) If I echo $filename at each loop, I see the function DOES scan all > my jpg files but no thumb is created > I tried to attrib -R my folders, to no avail :'S the result of str_replace() is a string representing a number but being not a number. So is_numeric() always returns FALSE. change your test criteria. -- Have you read the manual ? http://www.php.net/manual/en/ |
![]() |
| Thread Tools | |
| Display Modes | |
|
|