Hi,
i change image size and put on others, but image quality very poor, why?
(When i save image I set 100 quality)
$src = imagecreatetruecolor($new_width, $new_height);
$src2 = imagecreatefromjpeg($img_url);
imagecopyresampled($src, $src2, 0, 0, 0, 0, $new_width, $new_height, $new_img_size['org_w'], $new_img_size['org_h']);
$bg_size =...
I am working with jcrop and codeigniter to allow users to crop images that they upload, I want to the image t crop to a size of 90x60 but what ever I try nothing seems to work, my current code looks like this,
CONTROLLER
function save_crop() {
$this->load->library('image_lib');
$config['image_library'] = 'gd2';
...
How can you make a Koch Snowflake Fractal using php gd so that it comes out like this...
Is it possible? Is there another resource I can use?
...
So I'm in the middle of working on a website that deals with photographs. A user uploads their original photograph and GD library creates a smaller sized image of the same photo. However, when comparing a manually sized down image with the GD one, the GD image seems to lose quite a bit of color quality like it had been slightly desatur...
How can you make a sharpness filter with the PHP GD library?
So that this...
Turns to this...
If it is not possible with PHP, than what other languages are capable?
...
I'm using a convolution matrix for sharpness in PHP GD and I want to change the sharpness "level".
Where would I make changes to this if I want to make it more or less sharp?
$image = imagecreatefromjpeg('pic.jpg');
$matrix = array(
array(0, -1, 0),
array(-1, 5, -1),
array(0, -1, 0)
);
imageconvolution($image, $matrix, 1, 0...
OK i thought i understood this function but i have a complete mental block on this one.
I wanted to create cropped thumbnails of size 75x75 from photos that are 800x536.
the imagecopyresampled function has 10 possible parameters. i first tried this:
// Starting point of crop
$tlx = floor(($width / 2) - ($new_width / 2)); //fin...
I want to draw an image in PHP, which looks like the circle in the following image -
How should I proceed with this? Is there any available PHP plugin or something that I can use to generate this type of image, or should I use GD library and hand-code it myself?
EDIT
I am looking for some library that is open-source.
...
Can you allocate a color in PHP GD without an image resource? It should be possible because really an allocated color is a number, right?
$im = imagecreatetruecolor(100, 100);
$col = imagecolorallocate($im, 255, 0, 0);
print $col."<br/>";
$col2 = imagecolorallocate($im, 255, 0, 0);
print $col2."<br/>";
$im2 = imagecreatetruecolor(600, ...
I've made gradient images using PHP GD horizontal and vertical but how can you get images like these.
These are example images for the Emulate Gradient Fill PHP class
EDIT:
I want to know how to make these from scratch, the website is an example
...
Is it possible to have the PHP GD library output a .ico file?
Is there a function similar to imagepng?
...
Suppose you have a thumbnail generator script that accepts source images in the form of a URL. Is there a way to detect if the source URL is "broken" - whether nonexistent or leads to an non-image file?
Just brute force using getimagesize() or another PHP GD function is not a solution, since spoofed stray URL's that might not be imag...
I'm using imagettftext to make a bar graph and at the top of each bar I want to put the value.
I have the following variables for each bar (which are really rectangles)
$x1
$y1
$x2
$y2
$imagesx
$imagesy
$font_size
Also, The fontsize should decrease as the string length increases.
...
In a PHP module, We have a few graphics made by GD that need to have some Japanese words in it.
These words are entered manually from a form by Japanese users, and that text should be displayed within the graphics.
PHP has the mbstring module and can display and handle Japanese words via echo with no problem.
However gd displays ??? in...
I have created a captcha image making program with PHP
<?php
function word($n) {
$consonants = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ";
$vowels = "aeiou";
$word[1] = $consonants[rand(0, 41)];
$word[2] .= $vowels[rand(0, 4)];
$word[3] .= $consonants[rand(0, 41)];
$word[4] .= $consonants[rand(0, 41)];
ret...
In the PHP manual for base64_encode() I saw the following script for outputting an image.
<?php
$imgfile = "test.gif";
$handle = fopen($filename, "r");
$imgbinary = fread(fopen($imgfile, "r"), filesize($imgfile));
echo '<img src="data:image/gif;base64,' . base64_encode($imgbinary) . '" />';
?>
But how can you output an image dyna...
Finally I had to recompile PHP with --enable-gd-jis-conv.
However the text display is wrong, in Japanese.
$text = '夏の天気';
$fontfile = '/usr/share/fonts/japanese/TrueType/sazanami-mincho.ttf';
return imagettftext ($image, $size, $angle, $x, $y, $color, $fontfile, $text);
But different kanji (Japanese characters) are displayed inst...
So I basically have this:
$img = imagecreatefrompng('assets/other/redcircle.png');
imagepng($img);
imagedestroy($img);
So the redcircle.png file has a transparency (with anti aliasing). But GD just turns all the transparency in black? Is there a way to get back the original transparency?
...
I have seen tons of examples of Cropping images with php & the gd lib however I have never seen any posts on Skimming or Shaving an image. What I mean by this is say you have pictures from a digital camera that places the date on picture. It is always in a constant place on the picture. So how would I do this? All examples I have come ac...
So this creates the expected results, except that my image has multiple transparency levels (beyond opaque and invisible) for anti aliasing. Once I merge the two images, all the anti aliasing goes away. Does anyone know of a fix for this?
$width = 220;
$height = 220;
$sourcex = 150;
$sourcey = 250;
$dest = imagecreatetruecolor($width,...