gd

create white image with php

爷,独闯天下 提交于 2019-12-10 15:48:14
问题 I trying create empty white image with php, this s my code $bg = imagecreatetruecolor(120, 20); imagejpeg($bg,"test/myimg.jpg",100); but this created black image and I want create white, please tell how to set image for example white color? 回答1: <?php $img = imagecreatetruecolor(120, 20); $bg = imagecolorallocate ( $img, 255, 255, 255 ); imagefilledrectangle($img,0,0,120,20,$bg); imagejpeg($img,"myimg.jpg",100); ?> 来源: https://stackoverflow.com/questions/11914301/create-white-image-with-php

No PNG support in PHP GD Library but has GIF and JPEG Support. How can I fix this?

血红的双手。 提交于 2019-12-10 15:45:12
问题 I am running MAMP server Version 3.0.5 on OS X Yosemite. It seems to be missing PNG Support on my php files during execution Even before when I had MAMP 2.1, it had fatal errors on png related functions. The Jpeg functions work fine though. This is what my phpinfo looks like : Build Date Apr 10 2014 17:21:18 Configure Command './configure' '--with-mysql=/Applications/MAMP/Library' '--with-apxs2=/Applications/MAMP/Library/bin/apxs' '--with-gd' '--with-jpeg-dir=/Applications/MAMP/Library' '-

PHP GD image not displaying in Chrome

萝らか妹 提交于 2019-12-10 15:18:59
问题 We have used Captcha.php on one of our project, it opens in all browsers but we are not able to view in Google chrome Version 22. Our Captcha script session_start(); $captcha = new SimpleCaptcha(); $captcha->CreateImage(); class SimpleCaptcha { function CreateImage() { header("Content-Type: image/jpeg"); $md5 = md5(rand(0,9999)); $pass = substr($md5, 10, 5); $_SESSION["pass"] = $pass; $image = ImageCreatetruecolor(100, 20); $clr_white = ImageColorAllocate($image, 0, 0, 0); $clr_black =

php wrapper class for gd

只愿长相守 提交于 2019-12-10 14:55:00
问题 Can anyone recommend a wrapper class for the gd library? I've found a few, but they just have basic image manipulation functions, such as flipping, reversing, etc. I am really drawing here, so I want all the line, point, geometric figure, and color functions. And a basic palette, so I don't have to go through the hassle of defining basic colors all the time :Þ Edit: My webhost doesn't have 5.3 available. Surely there must be a class that doesn't rely on 5.3 features? 回答1: Imagine is an OO

Unable to find the “extensions” portion of my php.ini file, in apache 2.0, where is it?

痞子三分冷 提交于 2019-12-10 14:54:07
问题 I'm trying to add support for the GD extension on my Ubuntu, Apache 2, php box. However my php.ini file does not seem to be the same as most versions of the INI file and it appears that their are no ;extensions comments or a place holder for them. Where did this move to? Is their a new location or new method for adding extensions? I'm at a loss, I only found 2 php.ini files. One for Apache 2 and one for the command line interface. Ultimately I'm asking this question because the normal fix for

Install php7-gd in alpine

夙愿已清 提交于 2019-12-10 14:05:34
问题 This is my Dockerfile FROM php:7.1-fpm-alpine RUN docker-php-ext-install mysqli RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories && apk update && \ apk upgrade && \ apk add --update \ php7-gd mysqli is ok, but it does not load GD library. I also find gd.so in alpine container, please check the image: Please help 回答1: You should not mix Alpine Linux 3.4, Alpine Linux edge and PHP compiled from source. Solution 1 Use the official latest release of Alpine

how do i use imagecropauto() with IMG_CROP_TRANSPARENT?

你说的曾经没有我的故事 提交于 2019-12-10 13:22:14
问题 When I try to crop transparant area of an image, its get to keep it original size, and the transparant areas are turned black. If i run this code: <?php // Create a 300x300px transparant image with a 100px wide red circle in the middle $i = imagecreatetruecolor(300, 300); imagealphablending($i, FALSE); imagesavealpha($i, TRUE); $transparant = imagecolorallocatealpha($i, 0xDD, 0xDD, 0xDD, 0x7F); imagefill($i, 0, 0, $transparant); $red = imagecolorallocate($i, 0xFF, 0x0, 0x0);

How to account for font swash with PHP and GD

和自甴很熟 提交于 2019-12-10 13:07:30
问题 I have the following code to print text on an image. I am also adding a debug box around the text. However, I noticed the text on the left lies outside of the box that PHP gives me with imagettfbbox . This looks like an issue with the font swash. Is there anyway to account for this? Can I figure out the distance between the start of the swash and the actual position imagettfbbox gives to me? I don't think this is an issue with the font, as I tried it with a few script style fonts and the

How to resize image without storing it on a folder

淺唱寂寞╮ 提交于 2019-12-10 12:33:07
问题 So, i have been stuck on this for couple of hours. I have tired to google any solutions for this but didn't find solutions. So any help is greatly appreciated. My Issue: I am using form to upload multiple images. Due to data being backup on multiple servers i have to stored them on database. And storing the images on folder is not a solution. I thinks I can save the image onto the database but my I need to create a thumbnail of all the images which are being uploaded. So that's my problem,

imagecopyresampled() introduces artifacts in transparent PNG

不打扰是莪最后的温柔 提交于 2019-12-10 12:23:46
问题 I'm adding a transparent PNG watermark to an image. The watermark is high resolution so before overlaying it in the original image I resize it. This seems to introduce some artifacts in the watermark that I haven't found a way to avoid. Original image: Resized image (look at the horizontal line-like "dirt" between letters"): Zoom of resized image (not transparent) to clarify what I mean by the "dirt" between the letters. The area between "s" and "t" I've cleaned with the select tool and