加文字水印时出现图像“http://localhost/shopImooc/test/waterText”因出现错误而无法显示,该怎么解决啊?
代码如下:
<?php
$filename="../images/logo.jpg";
$fileInfo=getimagesize($filename);
//print_r($fileInfo);exit;
$mime=$fileInfo['mime'];
$createFun=str_replace("/","createfrom",$mime);
$outFun=str_replace("/",null,$mime);
$image=$createFun($filename);
$color=imagecolorallocatealpha($image, 255, 0, 0, 50);
$fontfile="../fonts/SIMKAI.TTF";
$text="imooc.com";
imagettftext($image, 14, 0, 0, 14, $color, $fontfile, $text);
//ob_clean();
header("content-type:".$mime);
$outFun($image,$filename);
imagedestroy($image);