gd

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

女生的网名这么多〃 提交于 2019-11-29 06:42:00
I am running Windows Server 2003 and need to install a version of GD. Can anyone point out some instructions or advice? Check php_gd2.dll is in your extension directory and uncomment ;extension=php_gd2.dll of your php.ini . 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 In Windows download related Debug Pack on php.net download page, it's contain most useful modules. After, uncomment related extension, for example to gd2: ;extension=php_gd2.dll on php.ini and

PHP create image from application/octet stream

北战南征 提交于 2019-11-29 05:15:29
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 Here is the code I use to create the image identifier...my handler works perfectly throughout my site, the

PHP: create image with ImagePng and convert with base64_encode in a single file?

隐身守侯 提交于 2019-11-29 03:26:14
I have created an image with ImagePng(). I dont want it to save the image to the file system but want to output it on the same page as base64 encode inline Image, like print '<p><img src="data:image/png;base64,'.base64_encode(ImagePng($png)).'" alt="image 1" width="96" height="48"/></p>'; which does not work. Is this possible in a single PHP file at all? Thanks in advance! Michael Berkowski The trick here will be to use output buffering to capture the output from imagepng() , which either sends output to the browser or a file. It doesn't return it to be stored in a variable (or base64 encoded)

How can I add jpeg support to Heroku PHP buildpack

﹥>﹥吖頭↗ 提交于 2019-11-29 02:45:56
I am developping an app using Heroku. I will need to manipulate images but unfortunately jpeg is not supported by default. I spoke with support and here is their answer: "We unfortunately don't support jpeg by default. But the good news is that we open sourced our PHP buildpack, so hopefully the community will be able to bring that in. In case you're interested, the buildpack is here: https://github.com/heroku/heroku-buildpack-php" I know I need to add --with-jpeg just before the --with-gd in the ./configure of PHP But the buildpack only gives the ability to update the php.ini and compile

PHP GD bundled extension without recompiling PHP - solution

社会主义新天地 提交于 2019-11-29 02:45:55
The bundled extension offer a lot of functionality. I have spent a lot of time how to compile extension for my version of PHP. So there are instructions. 0, Install PHP development package. Also You should have installed PHP with GD extension (but not bundled) sudo apt-get install php5-dev 1, Download source code of used PHP (for me 5.6.18) wget http://cz2.php.net/get/php-5.6.18.tar.gz/from/this/mirror -O php-5.6.18.tar.gz 2, Extract archive tar -xzf php-5.6.18.tar.gz 3, Go to the source code of GD extension cd php-5.6.18/ext/gd/ 4, Prepare the extension (run phpize in that directory) phpize 5

Overlay image with text and convert to image

♀尐吖头ヾ 提交于 2019-11-29 02:35:52
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-text-to-images-in-real-time-with-php/ Using GD and Freetype2, if both installed, then you can add text

Get image mimetype from resource in PHP/GD?

若如初见. 提交于 2019-11-29 02:08:22
I'm trying to find the mime type of an image. PHP has the function getimagesize but that only takes a filename, whereas I have an image "resource" instead - i.e. an image created from imagecreatefromstring . I found the functions imagesx and imagesy which return the width/height from a resource but I can't find any function that tell me the mime type from a resource. Anyone know of a way to do this? Note: Due to a weird server set up, we can't read/write files from the server normally, only through an FTP layer (which is where I read the image data from). I know this is pretty old, but just in

Using a transparent PNG as a clip mask

☆樱花仙子☆ 提交于 2019-11-29 02:05:18
Is it possible to take this image: And apply this mask: And turn it into this: Using either GD or Imagick? I know it's possible to mask an image using shapes but I'm not sure how to go on about doing it with a pre-created alphatransparent image. :s Using Imagick and ImageMagick version > 6 (I don't know if it will work on older versions): // Set image path $path = '/path/to/your/images/'; // Create new objects from png's $dude = new Imagick($path . 'dude.png'); $mask = new Imagick($path . 'dudemask.png'); // IMPORTANT! Must activate the opacity channel // See: http://www.php.net/manual/en

Image comparison with php + gd

孤者浪人 提交于 2019-11-29 01:36:37
问题 What's the best approach to comparing two images with php and the Graphic Draw (GD) Library? This is the scenario: I have an image, and I want to find which image of a given set is the most similar to it. The most similar image is in fact the same image, not pixel perfect match but the same image. I've dramatised the difference between the two images with the number one on the example just to ease the understanding of what I meant. Even though it brought no consistent results, my approach was

How can I upload an image from a URL in PHP

人盡茶涼 提交于 2019-11-29 00:15:21
In PHP using GD or imagemagick how can I uplaod a photo from a URL, I want to build a function that I can pass in a few parameters and uplaod the image, I can currentyl uplaod a big image, resize it smaller, then resize some more thumbnails off it and save all into there locations from 1 image but I would like to add the ability to get an image from a URL and then run my code on it to resize and make thumbs. Would I use curl or something else any example or ideas would be greatly appreciated $image = @ImageCreateFromString(@file_get_contents($imageURL)); if (is_resource($image) === true) { //