Click here to Skip to main content
16,016,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
<?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');


?>
Posted
Comments
Sergey Alexandrovich Kryukov 6-Nov-13 12:08pm    
In what line of code?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900