0
這個腳本一些如何顯示圖像而不是整個圖像的一半...我想這出這裏有什麼問題大小調整圖像 - 只顯示一半如果PIC
任何幫助,請
//文件
$ftimage = $_POST['feature_image'];
// maximum height 150 X width 150
$width = 150;
$height = 150;
// Dimensions Set
list($width_orig, $height_orig) = getimagesize($ftimage);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($ftimage);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
$image = imagejpeg($image_p, null, 100);
var_dump($image);
你嘗試用不同的圖像?同樣的結果給大家? – Uby
輸出'$ width_orig'和'$ height_orig',看看是否正確。 – bitWorking