gd

GD2 and PHP on OS X

非 Y 不嫁゛ 提交于 2019-12-12 16:03:20
问题 There are tons of links on this topic - but all have a different approach. I have a clean install of os x 10.5.6. I'm using the version of PHP that came with the OS. I have installed GD using FINK, it has installed associated packages. My question is, how do I now get GD support in PHP? (pref no macports or marc liyanage suggestions as that involves undoing the other installs of pear, mysql and php I have already done) 回答1: As Nerdling points out, PHP must be compiled with the GD extension

Email file is sending email two times using php mail function

﹥>﹥吖頭↗ 提交于 2019-12-12 16:02:45
问题 My three concerns, tried different combos with no result, googled but little or no help -- I received two times the email,change myemail@emailserver.com to the email id to see the result. While executing this file I am getting image, however I want to have text "Email Sent". Full HTML content with tag is passed instead of HTML rendering in email. My Working Code --> <?php header('Content-type: image/jpeg'); $jpg_image = imagecreatefromjpeg('http://dummyimage.com/600x400/f5f5f5/fff.jpg');

error installing libgd in mac 10.9

你。 提交于 2019-12-12 12:39:01
问题 I'm trying to install libgd on my mac OSX 10.9 following the instructions here (https://mikewest.org/2007/04/installing-libgd-from-source-on-os-x) and peaking on some more info here (Installing GD library for perl on MacOSX 10.6). the main goal is to be able to install and use Circos. i followed all the steps to install the various libraries libpgn, pibjpeg and freetype using mainly ./configure && make && make sudo install ...however 1) the ./congigure command from libgd does not find the

GD error while try load font

时光总嘲笑我的痴心妄想 提交于 2019-12-12 12:32:49
问题 I try load font by imageloadfont function. When I running script I receive error: gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully PHP Warning: imageloadfont(): Error reading font, invalid font header What can cause this problem? Env: Ubuntu 13.04 64-bit PHP 5.4.9-4ubuntu2.3 回答1: I saw this error while trying to randomly use one of the system's .ttf file. The PHP Manual example has .gdf font file. My image dimensions are 1013 x 638

Algorithm to find border color of an image in PHP

﹥>﹥吖頭↗ 提交于 2019-12-12 12:16:01
问题 I am trying to find a way to get a border color from an image using php I have tried to use this code, but this algorathim gives me all colors in any image. <?php function colorPalette($imageFile, $numColors, $granularity = 5) { $granularity = max(1, abs((int)$granularity)); $colors = array(); $size = @getimagesize($imageFile); if($size === false) { user_error("Unable to get image size data"); return false; } $img = @imagecreatefromjpeg($imageFile); if(!$img) { user_error("Unable to open

Partial black background when watermarking PNG image with GD PHP

佐手、 提交于 2019-12-12 11:18:37
问题 I have pieced together a PHP class to perform various image related functions using GD functions of PHP. It works great for all image types. Rotate, flip, resize, crop and to a lesser extent, watermark. All but the latter work perfectly. For example after a few changes, rotated PNG images retained their transparency whereas before they were losing that and the background turning black. Common problem, it appears. But all working now. Where I'm still getting stuck is watermarking a PNG image

Image processing and output using GD in php

女生的网名这么多〃 提交于 2019-12-12 10:07:54
问题 I want to control the display of images with the PHP GD library -- I am going to add some text to the bottom corner of it on the fly when a browser requests the image, rather than saving the text into the image. I know that I can do this: set the MIME type in the header and then call imagepng(...) with the filename to just display the image to the browser, but how would I embed it in a document? Like, <img src='somefile.php?i=1' ... /> do I just call imagepng with the filename but without

Center text on image using PHP GD

随声附和 提交于 2019-12-12 09:57:50
问题 So I am creating a banner generator. I will be adding text in the middle, but would like it to be exactly in the center. I know that imagettftext can be used to write onto the banner, but that won't center it. A likely solution could be to find the width of the text and then use half of it taken away from half of the banner width, but I've got no idea about how to do this. I am using PHP-GD and do not want to use anything else I will have to install. imagettftext($img, 14, 0, (468 - ((strlen(

Capture image with imagegrabscreen and Wamp

余生颓废 提交于 2019-12-12 09:34:08
问题 I'm trying to capture a local web page with imagegrabscreen but I only get a black screenshot. I tried almost every solution from questions here on SO and others sites and nothing works. I'm using and done the following: Windows 7 64bit Wamp 2.2a 64bit PHP 5.3.8 gd2 (version: "bundled 2.0.34 compatible") is installed and enabled. Allowed the apache service to interact with the desktop. I don't have a secondary display or anything. <?php $im = imagegrabscreen(); imagepng($im, "myscreenshot.png

Resize then crop PHP

纵饮孤独 提交于 2019-12-12 08:56:17
问题 Ok, basically I want all images to be 170x170px squares. Thus if an image is not a square i want it to be resized, and then cropped in the middle.. I have spent numerous hours playing with this and I am getting nowhere.. I have gotten it to crop a section of the bigger image etc, but i specifically need the image to be resized, then cropped.. Any help would be greatly appreciated. // get image size of img $x = @getimagesize($img); // image width $sw = $x[0]; // image height $sh = $x[1]; if(