gd

php安装gd库扩展

半腔热情 提交于 2020-04-12 19:02:28
目前服务器的环境是nginx+php-fpm,php使用源码最小化安装,所以就没有安装gd库。尽管没有安装gd库,但是我们还是可以通过单独编译安装gd库。 下面我们就开始来介绍如何给已经编译好的php环境安装gd库。gd库的安装分以下几个步骤: 1、gd库是什么 2、安装libpng 3、安装freetype 4、安装jpegsrc 5、安装gd库 6、检查gd库安装情况 一、gd库是什么 gd库是一个开源的图像处理库,它通过提供一系列用来处理图片的API,使其可以用来创建图表、图形、缩略图以及其他图像的处理操作。 gd库支持JPG、PNG、GIF等常见的图片格式。所以在安装gd库之前,我们需要安装libpng、jpegsrc、freetype这三款软件。 二、安装libpng libpng软件包包含libpng库,这些库被可以被其它软件用于处理png后缀的图片文件。 下载libpng,如下: wget http://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.gz 安装libpng,libpng的安装我们使用默认的选项。如下: tar -xf libpng-1.6.16.tar.gz cd libpng-1.6.16 ./configure make make install

drawing points evenly distributed on a circle

对着背影说爱祢 提交于 2020-02-05 10:17:28
问题 i want to get the coordinates of n points on a circle with the diameter of x i tried this: <?php header("Content-Type: image/png"); $img = @imagecreate(900, 900) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($img, 255, 255, 255); $red = imagecolorallocate($img, 255, 0, 0); for($i=0;$i<=360;$i+=10) { $x = round(cos($i)*400)+450; $y = round(sin($i)*400)+450; imagefilledellipse($img, $x, $y, 3, 3, $red); } imagepng($img); imagedestroy($img); ?> but there

Fetching a file on a server, resizing with PHP GD2, security considerations

谁说胖子不能爱 提交于 2020-02-01 08:42:16
问题 What are the security considerations when a server fetches a file from an untrusted domain? What are the security considerations when resizing an image that you don't trust with PHPs GD2 library? The file will be stored on the server machine, and will be offered for download. I know I can't trust the MIME-Type header. Is there anything else I should be aware of? I have a webservice that looks like this: input An http-URL (or a String that is expected to be a URL) output A meta description of

How to install GD on Heroku

谁说我不能喝 提交于 2020-02-01 03:08:07
问题 I am running Laravel 5.3 and trying to do some image manipulation. I get this error: GD Library extension not available with this PHP installation. I've tried putting gd in my composer.json "require": { "php": ">=5.6.4", "laravel/framework": "5.3.*", "mews/purifier": "~2.0", "vinkla/hashids": "^2.4", "barryvdh/laravel-debugbar": "^2.2", "fzaninotto/faker": "~1.4", "intervention/image": "^2.3", "gd": "*" }, and it didn't work. I also tried: "ext-gd": "*" and that didn't work either. I looked

How to display an inline image generated on the fly using PHP GD

。_饼干妹妹 提交于 2020-01-29 17:18:48
问题 I am trying the generate an image on the fly by merging images using PHP GD. I want to know if there is a way I can display the image inside my webpage without the need of storing it somewhere on server. Like for example I created the following code for merging the images... function create_image() { $main_image = imagecreatefrompng("images/main.png"); $other_image = imagecreatefrompng("images/other.png"); imagecopy($main_image, $other_image, 114, 53, 0, 0, 49, 34); imagepng($main_image);

How to display an inline image generated on the fly using PHP GD

浪尽此生 提交于 2020-01-29 17:18:05
问题 I am trying the generate an image on the fly by merging images using PHP GD. I want to know if there is a way I can display the image inside my webpage without the need of storing it somewhere on server. Like for example I created the following code for merging the images... function create_image() { $main_image = imagecreatefrompng("images/main.png"); $other_image = imagecreatefrompng("images/other.png"); imagecopy($main_image, $other_image, 114, 53, 0, 0, 49, 34); imagepng($main_image);

PHP GD Font Width Calculate Help

安稳与你 提交于 2020-01-25 09:16:08
问题 OK a little background story. I am redesigning one of my old websites and I want to use Myriad Pro for the title on the page. This will be dynamic with PHP, etc. At first I thought I should just use CSS styles and define Myriad as the main font. But after using typetester.org, I found that Myriad and let's say Arial are different heights even if they are the same font size. So I could use CSS and risk breaking my design in browsers without the font... So then I thought I could use sIFR.

PHP GD - Empty box

拈花ヽ惹草 提交于 2020-01-24 12:03:06
问题 Been searching for a while and can't seem to get through this. I'm (attempting) to learn php-gd, but for some reason no matter what, even by using ready-to-go code snippets, all I get when the file is run is a small, maybe 20x20px box with a plain border. Looked through phpinfo(); and gd is running fine, and I can't seem to find any errors with the code, any ideas?? <?php $redimg = imagecreatetruecolor(100, 100); $image = imagecreatefrompng('overlay.png'); // sets background to red $red =

PHP - Create Thumbnail & maintaining aspect ratio

做~自己de王妃 提交于 2020-01-21 02:18:48
问题 EDIT: This can be easily done in CSS, I didn't know CSS much at the time of writing this I have created a thumbnail creator using PHP. The thumbnails generated should be of the same size. But the problem is the use of uploads images having different aspect ratio like landscape or portrait the thumbnail becomes ugly. So I created the picture above for clarification. Whatever be the uploaded image, it will be put into a rectangle image. So the aspect ratio doesn't change and thumbnails will be

Overlay image with text and convert to image

不问归期 提交于 2020-01-20 03:40:25
问题 I want to add text to a jpg creating a new image. There will be image_1.jpg already on the server and I want to take the user submitted copy and put it on top of image_1.jpg creating a new image that combines the copy and the original image into a new rasterized jpg I know you can use GD Libraries in php to rasterize copy but can you layer it? My site is written in PHP but I am open to using 3rd party plug-ins. ANSWER:(OLD POST) but what I need http://blog.rafaeldohms.com.br/2008/02/12/adding