Android アプリがあり、Android アプリからの画像から 2 つの出力画像を PHP の POST で保存したいと考えています。
私たちの問題は、画像の種類が指定されておらず、アプリからのすべての種類の画像に .png 拡張子が付いていることです。私と同じように、画像のサイズを変更するには、そのタイプを指定する必要があります。では、このクラス
を使用して不明なタイプの画像のサイズを変更し、ファイルに保存するにはどうすればよいでしょうか?
私のコード:
if (isset($_FILES["img1"])){
move_uploaded_file($_FILES["img1"]["tmp_name"] , "../../spl_img/".$gallery_id."-img1.png");
$address = "../../spl_img/".$gallery_id."-img1.png";
$resizeObj = new resize($address);
$resizeObj -> resizeImage(80, 'portrait');
$resizeObj -> saveImage("../../spl_img_thumb/".$gallery_id."-img1.png", 100);
タイプがjpgで拡張子がpngの画像のサイズを変更したいときに受け取るエラー:
Warning: imagecreatetruecolor() expects parameter 2 to be long, string given in /home/porsojoy/public_html/webservice/spl_img/resize-class.php on line 76
Warning: imagecopyresampled() expects parameter 1 to be resource, null given in /home/porsojoy/public_html/webservice/spl_img/resize-class.php on line 77
Warning: imagejpeg() expects parameter 1 to be resource, null given in /home/porsojoy/public_html/webservice/spl_img/resize-class.php on line 217
Warning: imagedestroy() expects parameter 1 to be resource, null given in /home/porsojoy/public_html/webservice/spl_img/resize-class.php on line 246