ホーム » 2019 » 11月 » 28

日別アーカイブ: 2019/11/28

2019年11月
 12
3456789
10111213141516
17181920212223
24252627282930

カテゴリー

アーカイブ

ブログ統計情報

  • 77,446 アクセス



Win10 に IIS と PHP – 3

どこかに設定があるのかもしれないが,
PHP でのエラーなどのログファイル.
場所は c:\Windows\Temp\ .
Win10 IIS PHP のログファイル
今回テストした PHP のコード

<?php
	$tempfile =             $_FILES['fname']['tmp_name'];
	$filename = './data/' . $_FILES['fname']['name'] ;
	$up_status = false ;
	if (is_uploaded_file($tempfile)) {
		$up_status = move_uploaded_file($tempfile , $filename) ;
		}
	$link	= "" ;
	if ($up_status) {
		$p_info = pathinfo($filename) ;
		$pi_ext = $p_info['extension'] ;
		$bmp_name = $filename . ".bmp" ;
		$to_bmp = FALSE ;
		if  	($pi_ext == "png")  {	$img = imagecreatefrompng ($filename) ;   $to_bmp = imagebmp($img,$bmp_name) ;	}
		else if	($pi_ext == "jpg")  {	$img = imagecreatefromjpeg($filename) ;   $to_bmp = imagebmp($img,$bmp_name) ;	}
		else if ($pi_ext == "bmp")  {	$bmp_name = $filename ;                   $to_bmp = TRUE ;                 	}
		if ($to_bmp) {
			$cmd_to	= ("rsz_bmp.exe") . " " . $bmp_name ;
			exec	($cmd_to,$out,$ret) ;
			}
		if ($ret == 0) {
			$rsz_file = $out[count($out)-1] ;
			$bak_file = $filename . ".bak." . $pi_ext ;
			rename($filename,$bak_file) ;
			$rsz_name = pathinfo($rsz_file)['basename'] ;
			$file_rsz = $p_info['dirname'] . "/" . $rsz_name ;
			rename($rsz_file,$file_rsz) ;
			if    	($pi_ext == "png")  {	$img_bmp = imagecreatefrombmp($file_rsz) ;   imagepng ($img_bmp,$filename) ;	}
			else if	($pi_ext == "jpg")  {	$img_bmp = imagecreatefrombmp($file_rsz) ;   imagejpeg($img_bmp,$filename) ;	}
			else if ($pi_ext == "bmp")  {	copy($file_rsz,$filename) ;                                             	}
			if (!file_exists($filename)) {
				$filename = $file_rsz ;
				}
			}
		if (file_exists($filename)) {
			$link .= "<hr/>" ;
			$link .= "<a href='" ;
			$link .= $filename ;
			$link .= "'>" ;
			$link .= $filename ;
			$link .= "</a>" ;
			$link .= "<br/>" ;
			$link .= "<img src='" ;
			$link .= $filename ;
			$link .= "'>" ;
			}
		}
	?>

rsz_bmp.exe で画像ファイルを 2^n にリサイズし,その結果のファイル名を標準出力に出力する.
画像を出力する imagebmp などはあまり速くない.
同様の PHP を Synology NAS 上で.
https://itl.mydns.jp/…/tex_pow2.php
PHP のコードが悪いのか? Synology NAS では DIB から元の画像に戻すのがうまくいかない.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.