以下のソースのページ(up.html)から
<!DOCTYPE html> <html lang="ja"> <meta charset=utf-8> <body> <h3>画像のアップロード</h3> <form method="post" action="up.php" enctype="multipart/form-data" > <input type="file" name="a"><br> <input type="submit" value="アップロード"> </form> </body> </html>
画像をアップロードし、
<!DOCTYPE html> <html lang="ja"> <meta charset=utf-8> <body> <?php $a=$_FILES["a"]["name"]; $up=move_uploaded_file($_FILES["a"]["tmp_name"],"./".$a); var_dump($up); list($width,$height)=getimagesize($up); $nw=300; $nh=200; $moto=imagecreatefromjpeg($up); $saki=imagecreatetruecolor($nw,$nh); imagecopyresized($saki,$moto,0,0,0,0,$nw,$nh,$width,$height); imagejpeg($saki,$up); ?> </body> </html>
上記のソース(up.php)でリサイズするというものなのですが、実行するとプラウザ(up.php)には
bool(true) Warning: getimagesize(1): failed to open stream: No such file or directory in /home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php on line 10 Warning: imagecreatefromjpeg(1): failed to open stream: No such file or directory in /home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php on line 15 Warning: imagecopyresized() expects parameter 2 to be resource, boolean given in /home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php on line 19 Warning: imagejpeg(): Invalid 2nd parameter, it must a filename or a stream in /home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php on line 21
という表示がされます。
原因がわからず、困っています。
アドバイスをお願いいます。
ちなみにこれがプラウザ(up.php)の「ページのソースを表示」で表示したものです。
<!DOCTYPE html> <html lang="ja"> <meta charset=utf-8> <body> bool(true) <br /> <b>Warning</b>: getimagesize(1): failed to open stream: No such file or directory in <b>/home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php</b> on line <b>10</b><br /> <br /> <b>Warning</b>: imagecreatefromjpeg(1): failed to open stream: No such file or directory in <b>/home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php</b> on line <b>15</b><br /> <br /> <b>Warning</b>: imagecopyresized() expects parameter 2 to be resource, boolean given in <b>/home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php</b> on line <b>19</b><br /> <br /> <b>Warning</b>: imagejpeg(): Invalid 2nd parameter, it must a filename or a stream in <b>/home/websaka/websaka.php.xdomain.jp/public_html/2017_9_13/up.php</b> on line <b>21</b><br /> </body> </html>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/14 10:12 編集
2017/09/14 11:08