ホームページ >バックエンド開発 >PHPチュートリアル >PHP は画像のカラー レベルに基づいて位置とウォーターマークを決定します_PHP チュートリアル
ソースコードを直接共有する
<ol class="dp-c"> <li class="alt"><span><span><?php </span></span></li> <li> <span> </span>, <span class="keyword"></span>$output_file<span></span>, <span class="vars"></span>$x<span></span>, <span class="vars"> </span>$y<span></span>) { <span class="vars"></span><span> </span><span class="vars"> </span>$w1<span></span> = MagickGetImageWidth(<span class="vars"></span>$nmw_water<span></span>); </li> <li class="alt"> <span></span> = MagickGetImageHeight(<span class="keyword"></span>$nm w_water<span></span> <span class="func"></span><span></span>$); nmw<span class="vars"> </span> =NewMagickWand() <span></span> </li> <li> <span> </span><span class="keyword"> </span><span>//デフォルトのウォーターマーク位置調整 </span> </li> <li class="alt"> <span></span> </li> <li> <span> </span><span class="vars"> </span> = GetImageHeight(<span></span>$nmw<span class="vars"></span>); <span></span> </li> <li class="alt"> <span></span><span class="vars"></span> $x<span></span> = <span class="vars"></span>$w <span></span>; </li> <li> <span></span> </li>特定の状況への調整= 40;<li class="alt"><span> </span></li> <li> <span> MagickCompositeImage(</span><span class="vars">$nmw</span><span>, </span><span class="vars">$nmw_water</span><span>, MW_OverCompositeOp, </span><span class="vars">$x </span><span> - </span> <span class="vars">$w1</span><span> - </span><span class="vars">$lt_w</span><span>、</span><span class="vars">$ y</span><span> - </span><span class="vars">$h1</span><span> - </span><span class="vars">$lt_h</span><span>); </span> </li> <li class="alt"> <span> MagickWriteImage(</span><span class="vars">$nmw</span><span>, </span><span class="vars"> $output_file</span><span>); </span> </li> <li><span> </span></li> <li class="alt"> <span> DestroyMagickWand( </span><span class="vars">$nmw</span><span>); 使ってください </span> </li> <li><span></span></li> <li class="alt"><span>関数</span></li> add_ wm_recurse(<li> <span>$nmw_water</span> <span class="comment">, </span><span>$to_dir</span> </li>, <li class="alt"> <span>$output_dir</span><span class="keyword">, </span><span>$arr</span><span class="vars"> ) { </span><span></span><span class="vars"> = dir(</span><span>$to_dir</span><span class="vars">); </span><span></span><span class="vars"> </span>while<span></span>(</li> <li>$file<span></span>=<span class="vars"></span>$dp<span></span>->read ()){ <span class="vars"></span><span> </span> </li> <li class="alt"> != <span></span>.<span class="keyword"></span> && <span></span>$file<span class="vars"></span> != <span></span>...<span class="vars"></span>){ <span></span> </li> <li> <span></span>$to_dir<span class="keyword"></span> . <span></span>/<span class="vars"></span> <span></span>$ファイル<span class="string"> </span> )){ <span></span><span class="vars"></span> $file<span></span><span class="string"></span>); _dir<span></span> .</li> <li class="alt">/<span></span> .<span class="keyword"></span> <span></span><span class="func">http://www.bkjia.com/PHPjc/486032.html</span><span>www.bkjia.com</span><span class="vars">true</span><span>http://www.bkjia.com/PHPjc/486032.html</span><span class="string">技術記事</span><span>ソースコードを直接共有しますか?php function add_wm( $nmw_water , $src_file , $output_file , $x , $y ){ if ( file_exists ( $output_file )) return ; $w1 =MagickGetImageWidth( $nmw_water ); </span><span class="vars"></span><span> </span> </li> </ol>