1
getNameIndex($ i)我正在使用zip压缩文件函数来提取一些图像,我正在寻找一种方法,它提供了每个单独图像的文件路径,因此我可以使用getimagesize来获取下面的宽度和高度是我用来循环遍历文件的方法。从压缩文件中获取图像的高度和宽度
$chapterZip = new ZipArchive();
if ($chapterZip->open($_FILES['chapterUpload']['tmp_name']))
{
for($i = 0; $i < $chapterZip->numFiles; $i++) {
list($width, $height) = getimagesize(getNameIndex($i));
$imageLocation= "INSERT INTO imageLocation (imageLocation,imageWidth,imageHeight,chapterID) VALUES ('"."Manga/".$_POST['mangaName']."/".$_POST['chapterName']."/".$chapterZip->getNameIndex($i)."',".$width.",".$height.",".$chapterID.")";
getQuery($imageLocation,$l);
}
if($chapterZip->extractTo("Manga/".$_POST['mangaName']."/".$_POST['chapterName']))
{
$errmsg0.="You have successfully uploaded a manga chapter";
$chapterZip->close();
}
}
任何帮助,这将不胜感激!
请引擎收录所有的代码不只是一条线。 – 2010-08-21 08:35:06
不行!你必须先从档案中解压缩图像,然后在服务器上获得它们的宽度/高度。 – Otar 2010-08-21 08:47:33
是啊!谢谢,因为它从来没有发生过我,否则> _ < – dbomb101 2010-08-21 09:18:19