This is a contrived example, but it illustrates my problem much more concisely then the code I'm using - and I've tested this and it exhibits the problem:
$image = imagecreatefromjpeg('test.jpg');
$copy_of_image = $image;
// The important bit
imagedestroy($image);
header('Content-type: image/jpeg');
imagejpeg($copy_of_image);
No...
I'm able to draw a circle on a transparent background, but it's pixelated around the edges.
I can also get an anti-aliased circle on a non-transparent background with http://mierendo.com/software/antialiased_arcs/.
So, how do I get both?
...
Can anyone spot where I'm going wrong here. It should be creating grayscale copies of images in one folder and saving them in another folder. Could it be to do with the way im referencing the file locations. Folder permissions on both folders are 777. Script is running without visible error but no images are being created.
function gra...
I want to resize a image with DPI 300 or greater..
I want it's DPI to remain intact...
I have used GD library function to resize image cropped but it brings down DPI to 90!
please give a solution as my requirement involves no downsizing of DPI
...
I am setting up dynamic forum signature images for my users and I want to be able to put their username on the image. I am able to do this just fine, but since usernames are different lengths and I want to right align the username, how can I go about doing this when I have to set x & y coordinates.
$im = imagecreatefromjpeg("/path/to/b...
Hi, I have stumbled upon a nice PHP library that uses GD to generate a reflection of a picture.
I tried to modify the way so it also display the original image above its reflection to not have to align them in HTML.
The script can be found there :
http://reflection.corephp.co.uk/v3.php
Any idea if this can be done easily ? With my tes...
I want to cache the images of my gallery. Generating images every pages load using GD uses a lot of memory, So I am planning to create a cache image for the images generated by php script done with GD. What will be the best thing to create cache?
...
Is there a way to issue frames in a animated gif using php gd imagery?
...
Hello
I'm creating an dynamic image, which creates headers on my page using PHPs GD-library. The problem is, that I need a line-wrapping system. It's not a problem itself, but first I need to get the width (in pixels) of current character.
I'm pretty curious about this, is there any way? Or do I need to manually specify width of every ...
Hello,
how can I do this? I have an image 50x50 and I would like to generate one with 100x100, where the original 50x50 will be centered inside of that one. The rest would be filled with "transparent".
Thanks
...
Hey
I have some code that downloads an image from a remote server
$data = file_get_contents("$rURL");
I want to then change the quality of this image, but do not want to save it out to a file first, how do I convert $data into an image that I can then use in imagecopyresampled?
Thanks
...
Hi all,
I just installed gd2 using mac ports (sudo install gd2), which installed libraries in the following places:
/opt/local/include/gd.h
/opt/local/lib/libgd.dylib (link)
/opt/local/lib/libgd.la
/opt/local/lib/libgd.a
Here is my make file also:
dev: main.o
g++ -L/opt/local/lib -I/opt/local/include -lgd -lpng -lz -ljpeg -lfree...
I have an Apache2/mod_perl2 system up and running.
I'm using GD to create an image on the fly, and I'm then printing it like this:
$r->content_type('image/png');
binmode STDOUT;
print $im->png;
But is this the correct way to do things in mod_perl2?
(Ignore the fact that I'm generating an image on the fly and not caching it etc ...)
...
It seems like a trivial problem, but nothing I've tried will make the background transparent.
use strict;
use warnings;
use GD
GD::Image->trueColor(1);
my $im = new GD::Image(100, 100);
my $clear = $im->colorAllocateAlpha(255, 255, 255, 127);
my $black = $im->colorAllocateAlpha(0, 0, 0, 0);
$im->alphaBlending(0);
$im->filledRectangle...
Hello,
I can't slove this. I'm trying to make a text transparency but doesn't work.. Here how it looks: qshort.com/userbar/gd.php
Here how if possible to show with transparency: qshort.com/userbar/transparent.png
Is that possible? Here my PHP Code:
<?php
header('Content-type: image/png');
$im = imagecreatefrompng("signature.png"...
I'm simply trying to crop a JPEG image (no scaling) using PHP. Here is my function, along with the inputs.
function cropPicture($imageLoc, $width, $height, $x1, $y1) {
$newImage = imagecreatetruecolor($width, $height);
$source = imagecreatefromjpeg($imageLoc);
imagecopyresampled($newImage,$source,0,0,$x1,$y1,$width,$height,...
I need to resize images in php using GD to a fixed size but maintain the orientation (portrait/landscape), these are:
portrait: 375 x 500px
landscape: 500 x 375px
Everything I have tried always ignores the orientation and makes them all landscape.
Can anyone help?
...
I tried something like this but it just makes the background of the image white, not necessarily the alpha of the image. I wanted to just upload everything as jpg's so if i could somehow "flatten" a png image with some transparently to default it to just be white so i can use it as a jpg instead. Appreciate any help. Thanks.
$old = imag...
Using PHP's Image and GD functions you can use the following method to finally output the php image
imagepng($image);
Sometimes, for whatever reason the image may not be displayed typically the error is not with the image but with the actual php functions not executing successfully. However this causes a blank image to be returned whi...
I'm using the JpGraph library(PHP graphing Lib). I'm getting the foll error:
"JpGraph Error Your PHP installation does not seem to have the required GD 2.x library enabled. Please see the PHP documentation, "Image" section. Make sure that "php_gd2.dll" statement is uncomment in the [modules] section in the php.ini file"
I uncommented t...