gd

Duplicate a image variable GD library

霸气de小男生 提交于 2019-12-01 21:17:04
问题 What is the easiest way to duplicate an image variable in PHP. Normally you can simply do $varnew = $varold . But with a GD library variable if I did the above and then edited $varnew then $varold would be effected too. Obviously one way would be to reopen the file or to make a new image and copy it into it. Is there an easier way? 回答1: The reason your try didn't work is because the variable only stores a handle (a memory pointer) to the GD image. Both $varnew and $varold will still store the

How to include an image inside another image in PHP?

≯℡__Kan透↙ 提交于 2019-12-01 21:04:15
How to include an image inside another image in PHP? I want to do it like in twitterbackgrounds.com personalized backgroud. there is one main image and we can upload four personal images after that it will show as watermark of the main image. Well, there are several possibilies to do that. The one that pops into my mind is to use a php page where you can upload all files needed for this. After submission you can use imagemagick to create the new image with watermarks and display it on another webpage or store it to a database. Here is a good tutorial on how to use imagemagick to create the

Background transperancy in imagerotate()

冷暖自知 提交于 2019-12-01 20:54:12
问题 Since last 2 days, I was trying to add transperancy to the background after rotating an image using imagerotate() PHP-GD function. But, to my great disappointment, it's not working at all. It's just giving out a black background behind it. Here's my code - $patchImageS = 'image.png'; // the image to be patched over the final bg $patchImage = imagecreatefrompng($patchImageS); // resource of image to be patched $patchImage = imagerotate($patchImage, 23, 0, 0); imagepng($patchImage,'tt.png'); I

Writing curved text on an arc (PHP)

你。 提交于 2019-12-01 20:44:19
So I Googled and found out how to draw an arc: http://www.php.net/manual/en/function.imagearc.php The only problem is how do I write text $margin pixels from the arc that is curved. Centre aligned @ $degrees. Here is an example: http://img194.imageshack.us/img194/3667/scan0001fe.jpg Let me know if this doesn't make sense. Here is a simple PHP solution found at http://forums.phpfreaks.com/topic/57542-image-manipulation-skewing-text-text-on-a-curve/ You could try this: http://coding.derkeiler.com/Archive/PHP/alt.php/2004-12/0061.html Imagick has native support for curved text 来源: https:/

Duplicate a image variable GD library

杀马特。学长 韩版系。学妹 提交于 2019-12-01 20:36:49
What is the easiest way to duplicate an image variable in PHP. Normally you can simply do $varnew = $varold . But with a GD library variable if I did the above and then edited $varnew then $varold would be effected too. Obviously one way would be to reopen the file or to make a new image and copy it into it. Is there an easier way? The reason your try didn't work is because the variable only stores a handle (a memory pointer) to the GD image. Both $varnew and $varold will still store the same pointer, thus pointing to the exact same image in memory. You have to use imagecopy or, maybe worse,

Image can not be displayed because it contains error in php gd

独自空忆成欢 提交于 2019-12-01 19:34:22
This is the Link I am following to create an image, however my GD is installed and working correctly as i tested with the very first example but this code breaks and flag " Image can not be displayed because it contains error " . CODE - <?php //phpinfo(); //Report any errors ini_set("display_errors", "1"); error_reporting(E_ALL); //Set the content type header('content-type: image/png'); //Create our basic image stream 300x300 pixels $image = imagecreate(300, 300); //$image = imagecreatetruecolor(300, 300); //Set up some colors, use a dark gray as the background color $dark_grey =

Writing curved text on an arc (PHP)

拥有回忆 提交于 2019-12-01 19:33:16
问题 So I Googled and found out how to draw an arc: http://www.php.net/manual/en/function.imagearc.php The only problem is how do I write text $margin pixels from the arc that is curved. Centre aligned @ $degrees. Here is an example: http://img194.imageshack.us/img194/3667/scan0001fe.jpg Let me know if this doesn't make sense. 回答1: Here is a simple PHP solution found at http://forums.phpfreaks.com/topic/57542-image-manipulation-skewing-text-text-on-a-curve/ 回答2: You could try this: http://coding

get the characters available in TrueType with PHP

为君一笑 提交于 2019-12-01 19:17:04
问题 How do I get a list of all characters available in the TrueType font? using PHP. 回答1: PHP does not seem to have any extension that works directly with FreeType, the reigning open source library to deal with TrueType fonts. You may have to shell out to another language with an appropriate library, like Perl's Font::FreeType::Glyph, which will let you ask each font whether it has a representation of a particular glyph. In the alternative, you could write the proper PHP extension directly in C.

Background transperancy in imagerotate()

筅森魡賤 提交于 2019-12-01 18:32:07
Since last 2 days, I was trying to add transperancy to the background after rotating an image using imagerotate() PHP-GD function. But, to my great disappointment, it's not working at all. It's just giving out a black background behind it. Here's my code - $patchImageS = 'image.png'; // the image to be patched over the final bg $patchImage = imagecreatefrompng($patchImageS); // resource of image to be patched $patchImage = imagerotate($patchImage, 23, 0, 0); imagepng($patchImage,'tt.png'); I tried to change the parameters being passed in function to imagerotate($patchImage, 23, 5, 0);

Resizing with GD outputs black images

廉价感情. 提交于 2019-12-01 15:39:55
What can cause php gd to produce a black image after resizing? The following code always outputs a black image for every valid jpeg file. <?php $filename = 'test.jpg'; $percent = 0.5; header('Content-Type: image/jpeg'); list($width, $height) = getimagesize($filename); $newwidth = $width * $percent; $newheight = $height * $percent; $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($filename); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb); imagedestroy($thumb); ?> output of gd_info() : Array ( [GD