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