gd

Unusual result when merging two transparent images in php

瘦欲@ 提交于 2019-12-06 07:48:46
Im wondering if I'm doing something wrong, or if this is as good a result as im going to get. Both PNGs on the left are 95x111. The image of the robot has a 5px or so padding of transparent pixels around it, but it seems to be causing problems when they merge? $avatar = imagecreatefrompng("../guy.png"); $borderImg = imagecreatefrompng("../frame.png"); imagealphablending( $borderImg, false ); imagesavealpha( $borderImg, true ); imagecopyresampled($avatar,$borderImg, 0, 0, 0, 0, 95, 111,95, 111); imagepng($avatar, $newfilenameBig); Ive tried every combo of imagealphablending and imagesavealpha I

PHP - change background color to transparent

爷,独闯天下 提交于 2019-12-06 07:34:43
问题 I need to change background color of PNG picture (https://chart.googleapis.com/chart?cht=lxy&chd=e:AACIERGZIiKqMzO7RETMVVXdZmbud3f.iIkQmZohqqsyu7xDzM1U3d5l7u92,hhiIivfFmZZmcCY.YYZmTgdQjWd3kk6g880asfu7r4sf4E22tGtGsfzzmZj9&chds=0.0,1.0&chs=105x75&chma=1,0,1,1&chco=42b6c9ff&chls=2.5,1.0,0.0&chxl=0:%7C%7C1:%7C%7C2:%7C) to transparent. I use the following code which seems to me right: $picture = imagecreatefrompng("https://chart.googleapis.com/chart?cht=lxy&chd=e:AACIERGZIiKqMzO7RETMVVXdZmbud3f

Mystery issue with GIF upload?

烂漫一生 提交于 2019-12-06 07:14:14
Alright, so whenever I upload this GIF to my board (NGINX+PHP-FPM) I get a slow down until an eventual 504 Gateway Time-out, alright, so I know what you're thinking, "go ahead and fix those nginx.conf and php-fpm settings", well I tweaked them to near perfection last night, my server is running brilliantly now. However, that one particular GIF still screws up, runs php-FPM to almost 100% (I have a great top of the line quad core processor in my server, my server is by no means primitive). So want to know where it gets weirder? I've uploaded 10MB GIF's with bigger dimensions than the one in

export arabic text as images

坚强是说给别人听的谎言 提交于 2019-12-06 06:04:34
问题 I have a bunch of lines of Arabic text in UTF-8. The device I am trying to display this one does not support arabic text being displayed. Therefore, I need to convert the text into images. I would like to save each line of text as an image with a specific width. I need to use a specific font as well. What is the best way to do this? Does anybody know of a tool that can be helpful here? Problems I've run into so far: PHP + GD: Arabic letters appear seperated and not in cursive as they should.

Merge two images with transparencies in PHP

℡╲_俬逩灬. 提交于 2019-12-06 04:43:15
问题 I'm attempting to make a composite image of several .png's with background transparencies via php and store the resulting image in my database. My problem is that the transparent sections of my images are being dropped when I merge the images. This is my code to create the composite image: $base = imagecreatefrompng('application/assets/images/vel1_bg.png'); imagealphablending($base, true); list($baseWidth, $baseHeight, $type, $attr) = getimagesize('application/assets/images/vel1_bg.png');

Auto Font Size For Text (GD via PHP)

南楼画角 提交于 2019-12-06 04:06:15
问题 There is a space of x*y for text to go on $im (GD Image Resource) how can I choose a font size (or write text such that) it does not overflow over that area? 回答1: I think you look for the imagettfbbox function. I used that some years ago for a script generating localized buttons for a Web interface. I actually resized buttons if the text didn't fit in the template, to keep text size consistent, but you can try to reduce the text size until the text fits. If you are interested, I can paste

Unable to create GD image resource from BMP with MIME type 'image/x-ms-bmp' in PHP

依然范特西╮ 提交于 2019-12-06 03:51:24
I'm trying to create a GD image resource from a BMP image, however I'm having no luck. The BMP image in question was created and saved with Photoshop. I've tried a couple of BMPs I found on the web too, and they gave the same results. getimagesize() tells me the BMP image has an image type of IMAGETYPE_BMP (6) and a MIME type of 'image/x-ms-bmp'. I've tried running the image through imagecreatefromwbmp() and imagecreatefromxbm(), but neither recognise it. I've also tried running it through imagecreatefromstring(), but that errored saying 'Data is not in a recognized format'. I'm running XAMPP

Identical code producing inconsistent image quality on different servers

扶醉桌前 提交于 2019-12-06 02:33:44
问题 Take the following two images: Dev Version - IIS7 Windows 7 Pro 64bit Machine Live Version - IIS7 Windows Server 2008 64bit Machine Note how the Live Version is "pixelly" & looks low quality, the Dev Version however is smooth, anti-aliased & looks fine. These are both generated by identical code: ' Settings Dim MaxHeight As Integer = 140 Dim MaxWidth As Integer = 140 Dim WorkingFolderPath As String = "\\server\share\bla\" Dim AllowedFileExtensions As New ArrayList AllowedFileExtensions.Add("

Black background on GIF instead of transparency in PHP using imagegif()

我们两清 提交于 2019-12-06 02:15:11
Edit 2: SUCCESS! many thanks to moycakes! The correct way to convert a PNG to a GIF while retaining transparency goes as follows: $input = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAAEYCAYAAABfgk2GAAAemklEQVR4Xu2dzYsm13WHe7rHxGATtw1Zu8UMY0wIkv6AoF44ZOEspFWyUytkkRASJG0sgS2NPkCKF5qxMSSboNbOu4xJcAxZaJRNlhqRVYaZpPUPSC2wiYmm38k5rS75delW1b1V9+Pcuk9BMR/vrXvPfc6p33veU7eqLu2wQQACEIBAEwQuNTFLJgkBCEAAAjsIPkEAAQhAoBECCH4jjmaaEIAABBB8YgACEIBAIwQQ/EYczTQhAAEIIPjEAAQgAIFGCCD4jTiaaUIAAhBA8IkBCEAAAo0QQPAbcTTThAAEIIDgEwMQgAAEGiGA4DfiaKYJAQhAAMGvJwYeE1OfkP3JC5P3L

print quality images with php and GD

微笑、不失礼 提交于 2019-12-06 01:15:14
I need to take a photo someone has uploaded through a form, resize, merge with a high-res frame @ 300dpi and keep it all @ 300dpi for the best quality for print. is it possible to handle high-res images through GD and if so, could you provide some information on how? I have code that already does the resizing and merging, but i'm not sure if its going to work at the correct dpi. Thanks It's basically possible: Just use the proper amount of pixels. (The dpi unit has no meaning in digital imaging, it serves only to convert a digital [pixel] image into a physical format). Example: 11 x 8 inch