Questions tagged [php-gd]

The PHP GD class contains built in image manipulation for PHP versions 4.3 and up.

The PHP GD class contains built in image manipulation for versions 4.3 and up. This class is commonly used for:

  • Adding filters to images
  • Adding watermarks to images
  • Changing image size for upload
  • Outputting an image to the buffer
  • Creating images on the fly (e.g. captcha verification)

A download of the library can be found at https://bitbucket.org/pierrejoye/gd-libgd/downloads

370 questions
1
vote
0 answers

Dynamic banner with PHP GD ? Flush the cache at every load?

I have a banner in my signature in a forum and I would like to track the number of views it had. I am willing to use PHP GD to encode and an image and increment my counter every time it's accessed. here's my code for banner.php now (havent…
None
  • 302
  • 3
  • 20
1
vote
1 answer

Concrete5 PHP GD running out of memory

I ran into this rather annoying issue the other day; when a page tries to load it will just 'stop' half way through returning half a page to the end user. The exact error is shown below. [03-Jul-2015 03:15:04 Europe/London] PHP Fatal error: Allowed…
FortuneCookie101
  • 505
  • 1
  • 7
  • 19
1
vote
1 answer

How to merge jpg and png images using php?

This is png image: This is jpg image: Both are same width and height. Expected output: Code that I am using:
Asif Iqbal
  • 1,132
  • 1
  • 10
  • 23
1
vote
0 answers

Intervention Image produces broken image in Laravel 5

tried to find some reason for this strange issue for some time now, I hope somebody can help me. I have a Laravel 5 app. There is one controller method that should return an image from the storage (S3 or local) and add some filling for png…
mvmoay
  • 1,535
  • 3
  • 15
  • 26
1
vote
0 answers

Laravel: Image compression not working on server

I want to compress images before I upload them to my s3. This is the code I'm using to compress the images. //compress image before uploading public static function compressedImage($img, $file_name, $ext){ $original_img; …
Osei-Bonsu Christian
  • 2,935
  • 1
  • 15
  • 8
1
vote
1 answer

PHP: PNG readfile encoding issue

I have this code which outputs a PNG file to the browser header('Content-type: image/png'); header("Content-Length: " . filesize($cache_file)); readfile($cache_file); exit(); The file $cache_file was saved like this imagepng(self::$image,…
unloco
  • 6,928
  • 2
  • 47
  • 58
1
vote
0 answers

'Filename cannot be empty' appears when use imagecreatefromjpeg() function

I have a code to upload an image, then creates thumbnail on the fly for this uploaded image. The following code that creates the thumbnail (thumb.php). $fileName = filter_input(INPUT_GET, 'src'); $width = filter_input(INPUT_GET, 'width',…
Lion King
  • 32,851
  • 25
  • 81
  • 143
1
vote
1 answer

How can I manage css and php gd2 font size?

Font size of php gd2 and css is different. How can I manage it? Any formula to manage it? Because when I send a string with font size in css it prints much larger in php gd2 than css font. Please tell me some ideas to manage it.
user4277597
1
vote
2 answers

php_gd2 is not working on windows 8.1

php_gd2 is not working on windows 8.1 every thing is ok php gd info is given below. Array ( [GD Version] => bundled (2.1.0 compatible) [FreeType Support] => 1 [FreeType Linkage] => with freetype [T1Lib Support] => [GIF Read Support] => 1 [GIF Create…
user4277597
1
vote
1 answer

How to create primitive image in PHP w/o any libraries?

I'm running php on an intranet-server w/o www-connectivity and without any graphics-libraries installed. Now I need to create a color-block of 16x16 pixels (coloured #86D0FF) and was wondering if there was a way to return the required sequence of…
MBaas
  • 7,248
  • 6
  • 44
  • 61
1
vote
2 answers

trying to install php gd extension php55-common conflicts with php-common-5.3

I am trying to install php gd extension on php5.5 amazon ec2 server using this command yum install php-gd log: Loaded plugins: priorities, update-motd, upgrade-helper Resolving Dependencies --> Running transaction check ---> Package php-gd.x86_64…
Khaled Hasania
  • 335
  • 6
  • 14
1
vote
3 answers

PHP - Compress Image to Meet File Size Limit

I have to upload image files that meet a max width dimension and max file size. I have the code that checks width size and resizes the image to meet the max image width. However, when I am saving the file I can set the quality imagejpeg(…
nomaam
  • 1,213
  • 2
  • 22
  • 37
1
vote
4 answers

Creating PNG thumbnail using PHP

I'm trying to create a thumbnail image it returned an error, that imagecopyresized() expects 2 parameter to be resource, but it can create the image but the output is only a small black image. here is my code $image = "asd.PNG"; $image_size =…
user3746881
  • 51
  • 2
  • 9
1
vote
4 answers

PHP-GD How I can check the type (jpeg, gif ..) with a url of facebook?

If a user has no photo facebook instead of a jpeg get a gif. How I can check the type? I have tried the following: $PIC_Friend = imagecreatefromstring(file_get_contents('http://graph.facebook.com/'. id .'/picture?width=50&height=50'));…
ephramd
  • 561
  • 2
  • 15
  • 41
1
vote
1 answer

Create an image with PHP GD using a dynamically generated image

I have a script that dynamically alters an image. I would like to read the dynamically generated image into another PHP script. What I mean is: $image = imagecreatefromjpeg('effect.php?path=pic.jpg'); However this does not work. What can I do?…
Leopold Joy
  • 4,524
  • 4
  • 28
  • 37