Questions tagged [gd]

GD Library is used to dynamically create and manipulate image files.

GD is an acronym for GIF Draw, GD is an open source code library for the dynamic creation of images by programmers. GD is written in , and "wrappers" are available for Perl, PHP and other languages. GD creates , and images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve website development.

2961 questions
1
vote
1 answer

adding watermark to png images with the help of php

I want to watermark png images with a png image file. The following code does work with jpeg files, but png files. I have tried to change the code a bit (following) without luck. i.e. $image=imagecreatefromjpeg($original_image); into…
1
vote
3 answers

PHP gd create image, add to folder and db

I have created this image: header('content-type: image/jpeg'); //Load our base image $image = imagecreatefrompng(BASEPATH . '../images/blogMainImage.png'); //Setup colors and font file $white = imagecolorallocate($image, 255, 255,…
Prajwol Onta
  • 1,448
  • 5
  • 21
  • 48
1
vote
1 answer

Image resize and keep ratio bug

I found and modified a GD image resize and keep ratio script but it's not working as it should. For example I want to resize a picture to MAXIMUM 200w x 200h keeping ratio. The picture I want to resize is 518w x 691h and the script should resize it…
sorinu26
  • 1,122
  • 2
  • 13
  • 20
1
vote
1 answer

How to generate image for a label printer

I have an image that I create which get's initialized like so: $width = 800; $height = 600; $im = @imagecreate($width, $height); $background_color = imagecolorallocate($im, 255, 255, 255); $text_color = imagecolorallocate($im, 0, 0, 0); $font1 =…
user1477388
  • 20,790
  • 32
  • 144
  • 264
1
vote
1 answer

Codeigniter Image_lib library source_img

Here's my code : if(isset($_FILES["image"])){ $upload_dir = "files/images/user/profile/"; $ext = end(explode(".", $_FILES["image"]["name"])); $config['upload_path'] = $upload_dir."original/"; …
Dangling Cruze
  • 3,283
  • 3
  • 32
  • 43
1
vote
1 answer

php imagecreatefromsting gives warning: Data is not in recognized format

i am trying to create image from url returned by linkshare. while i run my code i get error: imagecreatefromstring: Data is not in recognized format. Help me how to generate image from url returned by third party. Here is my…
Monika Yadav
  • 381
  • 2
  • 12
1
vote
2 answers

imageloadfont memory allocation multiplication would exceed INT_MAX

Attempting to load a font using imageloadfont and am running into the following error: imageloadfont(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully Below is the code that is causing the…
Anti-Dentite
  • 551
  • 1
  • 6
  • 11
1
vote
1 answer

Half Grayscale by imagefilter()

I know PHP's GD library can apply grayscale filter to an image, for example: $img = imagecreatefrompng('test.png'); $img = imagefilter($img, IMG_FILTER_GRAYSCALE); imagepng($img, 'test_updated.png'); Is there any method that can apply half of the…
Raptor
  • 53,206
  • 45
  • 230
  • 366
1
vote
1 answer

Trying to Convert Image to Fixed Palette in PHP/GD

I am trying to use GD in PHP to reduce an image to a fixed 60 color palette. (I am aware that the results will look poor, it's a small part of a program I'm writing to identify visually similar or duplicate images) I have a 8x8 60 color png of my…
Greg Schoppe
  • 576
  • 1
  • 7
  • 22
1
vote
2 answers

PHP Image Resize, with Thumbnailer Issue

Having an issue with a image resize function. Function // Image Resizer function MakeThumbnail($inputFile, $filepath, $ext, $maxWidth, $maxHeight){ /* Get some details about the image */ $srcDetails = getimagesize($inputFile); switch…
Kevin
  • 2,684
  • 6
  • 35
  • 64
1
vote
1 answer

How to upload an image to server on change

I have an input tag like
OnChange, I…
Mohammed Ashiq
  • 468
  • 4
  • 18
1
vote
1 answer

CPAN install GD fails

I've hit a roadblock installing GD with CPAN on a new server. The relevant error line is Can't load '/usr/local/lib/perl5/auto/GD/GD.so' for module GD: /usr/local/lib/perl5/auto/GD/GD.so: undefined symbol: gdImageCreateFromGd2Ptr at…
ddyer
  • 1,792
  • 19
  • 26
1
vote
0 answers

imagecreatefromjpeg and imagejpeg, instant quality loss?

So I ended up slicing all my functions up and debug why the quality loss is happening in all pictures I am uploading. Now I have 2 lines of code, which is simple to understand and where the issue is. See the quality…
Karem
  • 17,615
  • 72
  • 178
  • 278
1
vote
2 answers

Perl Image Resize using GD and maintain image quality

I am trying to resize the image using GD image library and perl, but when it is resized the quality of image is not same as original uploaded image.. Do you guys have any suggestion? Below is my code my $dest_w = $width; my $dest_h = $width * ($h /…
1
vote
1 answer

Image processing class in PHP

I need to build a PHP photo processing class, I know there are MANY that already exist to the public but I need to build one to do just what I need done and nothing extra and nothing less. I need my class to do this... 1) I create a new instance…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537