I am using this peace of PHP code to save and rename some images.
foreach ($phones as &$value)
{
$link_img =
$handle = @fopen($link_img, "r");
if ($handle)
{
while (!feof($handle))
{
$buffer .= fgets($handle, 4096);
}
fclose($handle);
$filename = "files/nokia_".$phone_model.".jpg";
$mystring = fopen($filename, "wb");
$handle = fopen($filename, "wb");
$numbytes = fwrite($handle, $buffer);
fclose($handle);
unset($buffer);
}
}
most of images are JPGs, i think that all files have extension .jpg, but one image I bump in to, have .jpg extension, but its gif (i think), ...
and then my foreach stops :(
how to handle that ?
thanks for your help, I learned much here at stackoverflow, and this is my first question.