XP read/write problem (I guess)

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); ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-14-2003
pouzzler
 
Posts: n/a
Default XP read/write problem (I guess)

<?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
Reply With Quote
  #2 (permalink)  
Old 12-16-2003
Jedi121
 
Posts: n/a
Default Re: XP read/write problem (I guess)

"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/

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:06 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0