FAQ Database Discussion Community


Fatal error: f_imageloadfont is not supported: NYI in HHVM

php,gd,hhvm
Getting the following error from gd using HHVM 3.7.1 Fatal error: f_imageloadfont is not supported: NYI I couldn't help to ask as I didn't find any information about how to fix it. This error did not happen to occur in PHP 5.3, 5.4 and 5.6 (didn't test 5.5). Update: If...

imagerotate changes original image's color

php,gd,php-imagine,wideimage
I am encountering a very strange behavior when rotating images with PHP. The original image is being changed during the rotation. As an example, here are the side by side images. It's hard to see, but if you look closely, the white area surrounding the knife is being changed from...

php remove pixels border around an image

php,image,imagemagick,gd
I use the following code to display a remote image and cache a local version of it. Now i need to find a way to remove 10 pixels all around the image because there's a border that needs to be removed before the image is displayed/cached. How can i use...

Which is the better way to manipulate an image, using gd lib or using the FileReader() with Jcrop? [closed]

php,html5,gd,jcrop
I am trying to resize and crop an image on a php page. I either want to use gd lib or jcrop with FileReader(). Which would be a better wat to go. what are the pros/cons ?

Resizing/Cropping Image to adjust into layout

php,css,gd
I'm having issue with the re-sizing / scaling the thumbnails in to the desired layout. I am able to generate the thumbnails here's the code to crop/resize. $filename = $key.$_FILES["files"]["name"][$key]; $filetmp = $_FILES["files"]["tmp_name"][$key]; $filetype = $_FILES["files"]["type"][$key]; $filesize = $_FILES["files"]["size"][$key]; $fileinfo = getimagesize($tmp_name); $filewidth = $fileinfo[0]; $fileheight = $fileinfo[1]; // GETS...

PHP GD How to circular crop 3 square images and merge into 1 image maintaining transparency

php,png,transparency,gd
I have 2 source images and I want to: Do a circular crop of each image, with the outside of the circle transparent Merge/copy all images back onto a destination transparent image. I have tried many examples, but can't seem to maintain transparency on the final image. I'm trying to...

Letter 'j' bugged with imagettftext function

php,png,gd,true-type-fonts,imagettftext
I've created a script to generate an avatar by using PHP and all work fine but when there is the letter j in $data1['username'], the letter erase a part of the previous letter. NOTE : I use calibri bold italic (Downloaded here) This is my code : $image = imagecreatefrompng("avatar.png");...

PHP image uploads - moving from one type to many

php,image,upload,gd
Currently I'm able to upload jpg files, and I'm saving them as jpg files. Obviously I'm unable to upload/save png files as it's hard-set to jpg. I'm trying to work out how I can move from jpg only to allow png, jpg and jpeg. public static function createAvatar() { //...

Get width and height of scaled down image after imagerotation?

php,rotation,gd
A followup to this question: How to get new width and height after an image has been rotated with imagerotate()? The answer I got is based on the filenames actual image size, but if I want to start from another width and height. How would I achieve that? See below...

Check image visible quality [PHP]

php,image,imagemagick,gd
I want to make image quality check. Maybe calculate some index of that quality. For example, lets say, user A uploads something like http://www.hyperconectados.com/wp-content/uploads/2014/03/Selfie.jpg and user B uploads something like http://www.privatewifi.com/wp-content/uploads/2014/02/selfie.jpg It's obvious, that B photo is professional and in good quality. There's another thing, that it's not good to...

GD image_png slow

php,gd,libpng
I am resizing several images, and sometimes image_png is taking 13 seconds to return the images, while most return in 0-1 seconds. An image with aspect ratio 320/480 is resized into 320x480 in "0 seconds" while into 750x1334 and 1242x2280 in 10-13 seconds. The slownesss is not on imagecopyresized (0...

Dynamic multi-color gradient image

php,image,gd,gradient
What i need to create is a dynamic multi-color gradient image like the below one : I need to create it dynamically for 2/3/4/5/6 colors, for now i'm working on 6 color gradient. What i've done till now is : $size = 1536; $thickness = 54; $im = imagecreatetruecolor($size, $thickness);...

Pizza slice shape using GD Image?

php,gd
I need to "transform" a normal rectangle image into a "pizze slice". So this: Must be stretched into this: This way I lose the actual wording, so it's not 100% correct. I need it to not just mask those parts, but also "stretch" the slice so it will fit into...

unable to upload an image using gd library php

php,html,gd
this php file receives data from a html file where an user uploads an image from his computer, as soon as the update button is clicked this php page returns an error in which it is stated that no such file or directory exists <?php error_reporting(E_ALL); ini_set('display_errors', 1);?> <?php $db...

Code utilizing GD ending up in an error that “image cannot be displayed”

php,gd
My code is as follows: <?php session_start(); $img=imagecreatetruecolor(150,50); $white=imagecolorallocate($img,255,255,255); $black=imagecolorallocate($img,0,0,0); $red=imagecolorallocate($img,255,0,0); $pink=imagecolorallocate($img,200,0,150); $grey=imagecolorallocate($img,150,150,150); $blue=imagecolorallocate($img,0,204,255); $redd=imagecolorallocate($img, 153, 0,0); function randomString($length){ $chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ023456789"; srand((double)microtime()*1000000);...

How can I trim white space off image with Intervention?

php,laravel-4,gd,intervention
I have a class that takes photos I download before reuploading to S3 for long-term storage and I want to trim the white space. When I store the temporary image (which works fine), I then try to call the Intervention trim() on it in my storeTempFile() method but that doesn't...

PHP imagejpeg() not working in Opera

php,gd,opera
I am using the following code to dynamically generate a background image: $image = imagecreatefromjpeg( 'FILENAME' ); header( 'Content-Type: image/jpeg' ); imagejpeg( $image ); Opera displays nothing when I try to view this script. Chrome and IE work fine, and if I add header( 'Content-Disposition: attachment; filename=download.jpg' ); Opera will...

How to convert text to (mutiple) images exactly?

php,html,image,gd
I am trying to convert pages of content, images, text and links to solely images, this would be easily done if it weren't for the fact the links have to stay the same (still work) (I have toyed with the idea converting links to hard text so they can be...

PHP Fatal error: Call to undefined function imagecreatefrompng()

php,module,gd
That is the error message that I get on my php error log. So far, I know that the GD library is the problem, it's not installed ( I think is not installed but it was working before in my server and now is not so I don't know what...

List of fonts that are pre-avaliable on gd

php,gd
Can anyone tell me the name of all fonts which are pre-avaliable with gd library, that means I do not have to use a imagettftext or imageloadfont?

Php code to create thumb not working after update

php,gd
The following php script creates a thumb and is part of an image gallery package. Though since a php update to version 5.6, the code doesn't work anymore because the appearance of 'eregi' in a dependent file. Does anyone knows an alternative function for 'eregi'? <?php include('config.inc.php'); $C_JGALL['extentions'] = "jpg|jpeg|gif|png";...

GDlib PHP - png to gif returns background transparent to black

php,png,gd,gif
When trying to convert PNG to GIF, return transparent to black: $file = "example.png" $whf = getimagesize($file); $wf = $whf[0]; $hf = $whf[1]; $h = "100"; $w = "100"; $img = imagecreatetruecolor($w, $h); $imgi = imagecreatefrompng($file); // Here means to be some magic code... imagecopyresampled($img, $imgi, 0, 0, 0, 0,...

image resize function reduces dimension but increases filesize

php,gd
This resize function increases the filesize (in kb) while the with of the image is reduced from 750px to 400px. How is that possible? class imageProcessing{ var $imageSizeX; var $imageSizeY; var $resizeX; var $resizeY; var $reduction; var $fileName; var $msg; var $image; var $imageType; var $myname; var $tag; /** **...

Watermarking centered instead of top right

php,image-processing,gd,watermark
I'm using a php function that creates a watermarkon the top right of an image. Here's the code : <?php function watermarking($source, $watermark, $save = NULL, $width = null, $height = null) { $watermark = @imagecreatefrompng($watermark) or exit("Impossible d'ouvrir le fichier (watermark)."); imageAlphaBlending($watermark, false); imageSaveAlpha($watermark, true); $imageString = @file_get_contents($source) or...