gd

How to rotate an image in GD Image Library while keeping transparency?

浪尽此生 提交于 2019-12-02 06:26:29
I'm making a skin previewer for my site; I need to rotate parts of an image to create a representation of this for my users to see. The skin is a PNG file, and all parts of it may have transparency or even none at all. I need to be able to rotate this image while keeping any transparency inside the image transparent, while also having the extended borders (You know, the area that wasn't part of the image before it was rotated) transparent. All of my attempts have left a black border around the image itself. Any help? Cut out the piece of the image you want to rotate Rotate preserving alpha

Generate TTF via image(s) using PHP?

人盡茶涼 提交于 2019-12-02 06:03:29
Are there existing libraries for generating .ttf via image(s) using PHP (say, a series of images)? There are several references about creating gdf from images, but I've not yet found examples of ttf-font creation via PHP. N.B. There are also several online resources that let you upload an image (write a letter in each box on an image template) to be instantly converted to a TTF. http://www.yourfonts.com is one of them To my knowledge, there is no such tool. Creating a TrueType font is a hugely difficult enterprise. A font consists of a lot of very complex information (see the "technical notes"

Accented characters not showing when using imagettftext with otf but showing with ttf

心不动则不痛 提交于 2019-12-02 05:11:29
I'm using imagettftext to generate images from OpenType files. Everything works until I try to use an accented character (e.g. å) or a character such as √. In their place I get the .notdef glyph. The fonts I'm using definitely have these characters. To make things even more frustrating, when I use a TTF everything works as expected. Any ideas? Thanks Sorry to tell you, but PHP OTF supports only standard Ascii characters. It's a well known fact that special characters in OTF only very rarely work. I'm afraid you will have to stick with TTF until they correct that. Not true! (answer 1)

Trying to generate proportionally cropped thumbnails at a fixed width/height with PHP GD

混江龙づ霸主 提交于 2019-12-02 03:58:41
I'm trying to create a Thumbnail Generator in PHP with GD that will take an image and reduce it to a fixed width/height. The square it takes from the original image (based on my fixed width/height) will come from the center of the image to give a proportionally correct thumbnail. I'll try to demonstrate that confusing sentence with some nice ASCII :} LANDSCAPE EXAMPLE: XXXXXXXXXXXXXXXX XXXXOOOOOOOOXXXX XXXXOOOOOOOOXXXX XXXXOOOOOOOOXXXX XXXXOOOOOOOOXXXX XXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX PORTRAIT EXAMPLE: XXXXXXXX XXXXXXXX OOOOOOOO OOOOOOOO OOOOOOOO OOOOOOOO XXXXXXXX XXXXXXXX

PHP GD sharpness filter

狂风中的少年 提交于 2019-12-02 02:17:42
问题 How can you make a sharpness filter with the PHP GD library? So that this... Turns to this... If it is not possible with PHP , than what other languages are capable? 回答1: I think he wants to use PHP's GD library. It's pretty easy: function.imageconvolution. Just search for 'sharpen' on the page and you'll see a matrix you can use for sharpening. It works pretty well, although I would recommend using ImageMagick if you're trying to do anything more than that. 回答2: If the ImageMagick is

PHP JPEG Functions Not Working

余生长醉 提交于 2019-12-02 01:59:31
Any PHP functions that deal with JPEGs don't seem to be working on my server. This code: <?php $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); header('Content-type: image/jpeg'); imagejpeg($im); imagedestroy($im); ?> creates an empty file. Using a GIF or PNG function will create an image containing the text "A Simple Text String" as expected. This: $im = imagecreatefromjpeg("test.jpg"); returns Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'test.jpg' is not a valid JPEG

PHP invalid image's and error handling

十年热恋 提交于 2019-12-02 01:24:51
问题 Using PHP's Image and GD functions you can use the following method to finally output the php image imagepng($image); Sometimes, for whatever reason the image may not be displayed typically the error is not with the image but with the actual php functions not executing successfully. However this causes a blank image to be returned which doesn't help me. What I want to know is, is there a way to detect a blank or an invalid image and create a new image, write the errors to the new image using

PHP GD sharpness filter

孤人 提交于 2019-12-02 00:09:33
How can you make a sharpness filter with the PHP GD library? So that this... Turns to this... If it is not possible with PHP , than what other languages are capable? I think he wants to use PHP's GD library. It's pretty easy: function.imageconvolution . Just search for 'sharpen' on the page and you'll see a matrix you can use for sharpening. It works pretty well, although I would recommend using ImageMagick if you're trying to do anything more than that. If the ImageMagick is installed in your PHP config, you can use Imagick::adaptiveSharpenImage From the manual: <?php try { $image = new

PHP GD not rendering unicode fonts properly

蓝咒 提交于 2019-12-02 00:08:57
I am having problems in rendering unicode glyphs ( language : Malayalam, Tamil and Hindi) with PHP GD library. Is this something related to the rendering engine of GD library? Any workarounds available ? First make sure your fonts contain the desired glyphs (system fonts such as Arial should). Then make sure you convert your parameters to unicode using utf8_decode() if neccessary. Sudhir Vishwakarma i have found one try this <?php //error_reporting(0); $text = ("Unreadable text"); $font = "mangal.ttf"; $fontSize = "10"; $width = '600'; $s = new CairoImageSurface(CairoFormat::ARGB32, $width, 21

Does html can be use with dynamic generated images in php?

时光毁灭记忆、已成空白 提交于 2019-12-01 21:57:19
I am using this code to create an image <?php // Set the content-type header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0