當我在php上使用imagecopyresized()
函數時,它返回爲圖像資源,我想要的是從此圖像獲取圖像數據resource.may可以像字符串或數組中的文件位置包含文件的多個數據,就像您在$ _FILES []全局數組中獲得的數據一樣。感謝從php圖像資源獲取圖像文件
$source = $_FILES['image']['tmp_name'];
list($width,$height) = getimagesize($source);
echo BR.$height." ".$width;
$desired_height = 28;
$scale = $width/$height;
$new_width = $desired_height * $scale;
$new_height = $desired_height;
$original_image = imagecreatefromjpeg($source);
$resized_image = imagecreatetruecolor($new_width, $new_height);
if(imagecopyresized($resized_image, $original_image, 0, 0, 0, 0, $new_width, $new_height, $width, $height)){
echo BR."image resized".BR;
}
我想存儲在數據庫中$resized_image
的位置,但我似乎無法從這個變量來訪問文件位置。