0
我想調整圖像的大小正好爲256 x 256像素。PHP圖像調整大小到正好是256 x 256像素拉伸
我目前使用...
$image_p = imagecreatetruecolor($imgMaxWidth, $imgMaxHeight);
imagecopyresampled($image_p, $source, 0, 0, 0, 0, $imgMaxWidth, $imgMaxHeight, $imgWidth, $imgHeight);
它只接受Maximum Width
和Maximum Height
。
如果我上傳615 x 339像素的圖像,我將得到一個調整大小爲256 x 141像素的圖像。
你能幫我嗎?
我做了同樣的方式顯示'的圖片:「http: //localhost/imageupload/untitled.php「無法顯示,因爲它包含錯誤.'這個錯誤................我也改變目標文件夾像這樣'imagepng($ image ,'photo_gallery /,100);' –
第二個參數是文件名(字符串),所以: 'imagepng($ image,「photo_gallery/my_image.png」,100);' – dimasdmm
它創建'my_image.png'文件'photo_gallery /'文件夾位它不是一個圖像文件,我無法打開,它的實際大小是0字節 –