gd

PHP: How to read “Title” of font from .ttf file?

烈酒焚心 提交于 2019-12-18 11:06:09
问题 I really need to be able to extract the metadata from a .ttf true type font file. I'm building a central database of all the fonts all our designers use (they're forever swapping fonts via email to take over design elements, etc). I want to get all the fonts, some have silly names like 00001.ttf, so file name is no help, but I know the fonts have metadata, I need some way to extract that in PHP. Then I can create a loop to look through the directories I've specified, get this data (and any

How do You Resize a High Resolution Picture with PHP

我怕爱的太早我们不能终老 提交于 2019-12-18 10:56:33
问题 I'm processing images when the user uploads a pic but my problem is high rez pics. How do you detect when the user uploads one? I'm using the GD library for PHP. Setting the quality to 90 with the imagejpeg() method doesn't do anything to it but scales the dimension and then sets the ppi to 72. I want to be able to preserve the dimension and drop the ppi to 72 at the same time. Any advice would be greatly appreciated. 回答1: There is no such thing as PPI as far as you need to be concerned. Also

Face detection in PHP

核能气质少年 提交于 2019-12-18 10:55:30
问题 Does anybody know of a good way to do face detection in PHP? I came across some code here that claims to do this, but I can't seem to get it to work properly. I'd like to make this work (even though it will be slow) and any help you can give me would be really appreciated. Here's the code from the link: <?php // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be

Face detection in PHP

南楼画角 提交于 2019-12-18 10:55:21
问题 Does anybody know of a good way to do face detection in PHP? I came across some code here that claims to do this, but I can't seem to get it to work properly. I'd like to make this work (even though it will be slow) and any help you can give me would be really appreciated. Here's the code from the link: <?php // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be

imagecopyresampled in PHP, can someone explain it?

僤鯓⒐⒋嵵緔 提交于 2019-12-18 07:04:09
问题 OK i thought i understood this function but i have a complete mental block on this one. I wanted to create cropped thumbnails of size 75x75 from photos that are 800x536. the imagecopyresampled function has 10 possible parameters. i first tried this: // Starting point of crop $tlx = floor(($width / 2) - ($new_width / 2)); //finds halfway point of big image and subtracts half of thumb. $tly = floor(($height / 2) - ($new_height / 2)); //gets centre of image to be cropped. imagecopyresampled($tmp

imagecopyresampled in PHP, can someone explain it?

这一生的挚爱 提交于 2019-12-18 07:04:06
问题 OK i thought i understood this function but i have a complete mental block on this one. I wanted to create cropped thumbnails of size 75x75 from photos that are 800x536. the imagecopyresampled function has 10 possible parameters. i first tried this: // Starting point of crop $tlx = floor(($width / 2) - ($new_width / 2)); //finds halfway point of big image and subtracts half of thumb. $tly = floor(($height / 2) - ($new_height / 2)); //gets centre of image to be cropped. imagecopyresampled($tmp

Invalid font filename (imagettfbox)

早过忘川 提交于 2019-12-18 06:56:31
问题 This question has been asked over and over but I could not find the correct answer to my problem... As a little background note, all the code was working perfectly before we moved the class file from /application/lib/class to /library/class ... I have tried to play with GDFONTPATH, relative, absolute paths with and without the file extension to no avail. Here is some of the lines we have tried so far: putenv('GDFONTPATH=' . realpath(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'fonts')); /

How do I install GD on my windows server version of PHP

孤街浪徒 提交于 2019-12-18 04:44:09
问题 I am running Windows Server 2003 and need to install a version of GD. Can anyone point out some instructions or advice? 回答1: Check php_gd2.dll is in your extension directory and uncomment ;extension=php_gd2.dll of your php.ini . 回答2: You need to edit your php.ini (found in your C:/PHP folder if you installed PHP here). Add the following line (or remove the ; before it if it exists in there): extension=php_gd2.dll 回答3: In Windows download related Debug Pack on php.net download page, it's

PHP create image from application/octet stream

烂漫一生 提交于 2019-12-18 04:21:51
问题 My application is having images sent to it from mobile devices with the content-type "application/octet-stream". I need to process these images using the GD library, which means I need to be able to create an image object from the data. Typically, I have been using imagecreatefromjpeg, imagecreatefrompng, imagecreatefromgif, etc, to handle files uploaded from web forms, but these don't seem to work when coming to me as application/octet-stream. Any ideas on how I can achieve my goal? EDIT

PHP create image from application/octet stream

廉价感情. 提交于 2019-12-18 04:21:45
问题 My application is having images sent to it from mobile devices with the content-type "application/octet-stream". I need to process these images using the GD library, which means I need to be able to create an image object from the data. Typically, I have been using imagecreatefromjpeg, imagecreatefrompng, imagecreatefromgif, etc, to handle files uploaded from web forms, but these don't seem to work when coming to me as application/octet-stream. Any ideas on how I can achieve my goal? EDIT