php GD图像语法错误 [英] php GD image syntax error

查看:86
本文介绍了php GD图像语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有一个PHP图片,但它不会显示。我得到的图像无法显示因为它包含错误错误。

那里有什么问题?



代码来自tuttorial

链接









 <?php  
$ image = ' bubble2.jpg'< /跨度>;
$ i = imagecreatefromjpeg($ image);








$ mult = 5;
$ w = imagesx($ i);
$ h = imagesy($ i);
$ image = imagecreatetruecolor($ w * $ mult,$ h * $ mult);
imagecopyresized($ image,$ i,0,0,0,0,$ w * $ mult,$ h * $ mult,$ w,$ h);
imagedestroy($ i);
$ w * = $ mult;
$ h * = $ mult;
$ im = imagecreatetruecolor($ w,$ h);
$ removed = imagecolorallocate($ im,($ background>> 16)& 0xFF,($ background>> 8)& 0xFF,$ background& 0xFF);
imagefill($ im,0,0,$ background);
imageantialias($ im,true);
$ nh = $ h - ($ h * $ gradient);
for ($ x = 0; $ x< $ w; $ x ++){
$ ni =(($ rightdown)? $ x :$ w- $ x);
$ p = intval($ h - (($ ni / $ w)* $ nh));
if (($ p%2)<> 0)
$ p- = 1;
$ nx = intval(($ p- $ h)/ 2);
imagecopyresampled($ im,$ image,$ x,0,$ x,$ nx,1,$ p,1,$ h-1);
imageline($ im,$ x,0,$ x, - $ nx-1,$ background);
imageline($ im,$ x,$ h-1,$ x,$ h + $ nx,$ background);
}
imagedestroy($ image);
imagefilter($ im,IMG_FILTER_SMOOTH,10);
$ i = imagecreatetruecolor($ w / $ mult,$ h / $ mult);
imageantialias($ i,true);
imagecopyresampled($ i,$ im,0,0,0,0,$ w,$ h,$ w * $ mult,$ h * $ mult);
imagedestroy($ im);
header(' Content-Type:image / png');


?>

解决方案

image = ' bubble2.jpg';


i = imagecreatefromjpeg(


image);

Hi I have a php image, but it wont show. I get the The image cannot be displayed becouse it contains errors Error.
Whats wrong there?

The code is from a tuttorial
Link




<?php
$image='bubble2.jpg';
$i = imagecreatefromjpeg($image);
	
   
 
	

	
	
	
$mult=5;
$w=imagesx($i);
$h=imagesy($i);
$image=imagecreatetruecolor($w*$mult,$h*$mult);
imagecopyresized($image,$i,0,0,0,0,$w*$mult,$h*$mult,$w,$h);
imagedestroy($i);
$w*=$mult;
$h*=$mult;
$im=imagecreatetruecolor($w,$h);
$removed=imagecolorallocate($im,($background>>16)&0xFF,($background>>8)&0xFF,$background&0xFF);
imagefill($im,0,0,$background);
imageantialias($im,true);
$nh=$h-($h*$gradient);
for ($x=0; $x<$w; $x++) {
 $ni=(($rightdown) ? $x : $w-$x);
 $p=intval($h-(($ni/$w)*$nh));
 if (($p%2)<>0)
  $p-=1;
 $nx=intval(($p-$h)/2);
 imagecopyresampled($im,$image,$x,0,$x,$nx,1,$p,1,$h-1);
 imageline($im,$x,0,$x,-$nx-1,$background);
 imageline($im,$x,$h-1,$x,$h+$nx,$background);
}
imagedestroy($image);
imagefilter($im,IMG_FILTER_SMOOTH,10);
$i=imagecreatetruecolor($w/$mult,$h/$mult);
imageantialias($i,true);
imagecopyresampled($i,$im,0,0,0,0,$w,$h,$w*$mult,$h*$mult);
imagedestroy($im);
header('Content-Type: image/png');


?>

解决方案

image='bubble2.jpg';


i = imagecreatefromjpeg(


image);


这篇关于php GD图像语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆