374 questions
0
votes
0
answers
49
views
How to fix this issue: Call to undefined function Intervention\Image\Drivers\Gd\Decoders\imagecreatefromjpeg() [duplicate]
When I want to upload a JPG image to my Laravel ecommerce website this error occured:
Call to undefined function Intervention\Image\Drivers\Gd\Decoders\imagecreatefromjpeg()
But when I uploaded a PNG ...
2
votes
1
answer
115
views
In PHP 8+ How to clear image data from script (previously imagedestroy())
Previous to PHP8 imagedestroy($image) would be used to clear image resource data from the server memory. This is very useful on crowded situations and especially when dealing in loops with processing ...
0
votes
1
answer
206
views
How to solve error while installing php-gd on oracle linux 7 for php 7.4
Trying to install php-gd on Oracle Linux 7 with php7.4.
sudo yum update
sudo yum install php-gd
Any of the above command generates below error:
Loaded plugins: langpacks, ulninfo
Resolving ...
0
votes
1
answer
66
views
php gdimage image montage poor quality issues
found some code on here at PHP - Create one image from images, the code works however, when I look at the output the edges of each image are extremely low quality (blocky).
Here is the code I'm using, ...
0
votes
1
answer
58
views
Fixing rotated image uploads In PHP
function generateRandomString($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$...
0
votes
0
answers
180
views
Cannot get PHP GD library working - Ubuntu 18.04.6 LTS
I have an older Ubuntu 18 box that for the life of me i cannot get GD working with my php 8
No matter what i try the gd.so file does not get placed in the correct directory.
I have multiple versions ...
0
votes
0
answers
88
views
PHP imagecropauto not cropping transparency but returning a white background
public static function font_preview_img($font_name='', $path=''){
$font_size = 25;
$im = imagecreatetruecolor( strlen($font_name)*$font_size, $font_size*2);
imagesavealpha($im, ...
1
vote
1
answer
166
views
Rendering Image on PHP symfony 2
I'm trying to generate an image using php-gd but the output is only special characters. Did I use the "header('Content-Type: image/png')" correct?
My Image Class:
public function __construct(...
1
vote
1
answer
2k
views
How do I compile PHP with freetype support on Ubuntu 20.04
On calling the function imagettfbbox(), I'm getting the error
Fatal error: Uncaught Exception: Function "imagettfbbox" does not exist: check your FreeType installation in...
I understand ...
1
vote
0
answers
1k
views
Is it possible to compress PNGs like tinyPNG/PngQuant with Php-gd/imagemagick/intervention?
Is it possible to compress PNGs with results similar to TinyPNG/PngQuant in regards to size reduction and quality retention, using vanilla PHP tools like PHP/GD, PHP/Imagemagick and/or intervention/...
0
votes
1
answer
435
views
Resizing from 4764px to 960px with php gd or imagemagick creates image of similiar size in KBs (970kb vs 802kb)
I am trying to resize an 4764 × 2680 pixels image to a 960px width image preserving it's aspect ratio. When doing this operation directly with Imagemagick command line tools, the output image would be ...
3
votes
1
answer
1k
views
Problems with php-gd in php8.1
I have php8.1 running on FreeBSD 12.
Install php81-gd and having a trouble to start php due to the following error:
Any guess how to fix it, please?
PHP Warning: PHP Startup: Unable to load dynamic ...
3
votes
1
answer
4k
views
Centos 7.2 php 7.3 - Unable to load dynamic library 'gd'
I installed php-gd and then check if is installed like this
[root@LP01-Dev ~]# php -v // checking before installing gd
PHP 7.3.33 (cli) (built: Nov 16 2021 11:18:28) ( NTS )
Copyright (c) ...
3
votes
0
answers
8k
views
Docker: php:8.1.1-fpm-alpine Install specific GD version
Is there any way to specify installed GD extension version?
Currently I have following Dockerfile:
ARG PHP_VERSION=8.1.1
FROM php:${PHP_VERSION}-fpm-alpine
RUN apk add --update --no-cache freetype ...
2
votes
0
answers
51
views
Alpha channel overwrites underlying non transparent part after imagecopyresampled
Got a strange thing in production env. Alpha channel overwrites underlying non transparent part after imagecopyresampled.
In dev it works as expected:
But in prod im getting this:
$bubble = ...
1
vote
0
answers
717
views
php extension gd not working php7.4.21 (Parrot Os)
I have search all over the internet just to find a solution for this problem.
I have php7.4 installed on my system. I have been struggling with the php-gd extension. I have been able to install the ...
0
votes
1
answer
2k
views
How to download php7.2-gd extension in ubuntu 21.04?
I want to install gd extension in my current php-project(php version is 7.2.34) for that i use this command sudo apt-get install php7.2-gd it's throwing following error and it's not showing in the ...
0
votes
0
answers
681
views
PHP: imagecolorat(): -1,0 is out of bounds
I have this code working before (6 years ago) while upgrading to the latest PHP8, it doesn't work anymore, well it does when using absurd way putting "error_reporting(0);"
$a = ...
0
votes
0
answers
59
views
PHP-GD: Trying to center text but it is showing up horizontally off-center
The PHP code below is supposed to center the letter "M" vertically and horizontally. Vertically it is perfectly centered, but horizontally it is off.
What is really strange is that the ...
0
votes
0
answers
128
views
Is there any function in PHP to compress image to desired size(in KB) or to the nearest size defined
I have a 500 kb image and I wanna compress it using PHP GD or Imagick library. But I didn't found any function or method to compress the image to the desired size (150 KB).
The function should try to ...
1
vote
0
answers
289
views
PHP-GD installed but required during the wordpress installation
I try to install Wordpress using Virtualmin manager. During the installation the manager return:
Error: Unable to find a match: php74-gd
after command: /bin/dnf -y install php74-gd
I have PHP 7.4 and ...
0
votes
0
answers
169
views
Certificate not showing in localhost i.e. imagecreatefromjpeg() not working
I want to create certificates for users on my website but following code isn't working and only showing grey square when loaded on localhost...
<?php
header('content-type:image/jpeg');
$font="...
0
votes
1
answer
149
views
Draw polygon extending beyond image-border
Note:
The question is specific to PHP GD library only
This question is NOT about how to crop image to a target aspect ratio, rather it is about how to draw overlay extending outside the image
I want ...
0
votes
2
answers
913
views
How do I add GD support to php 7.3 from xxamp?
I've got stuck with using of GD library.
I have installed and enabled at php.ini (extension=gd2) the library but when I try to use it I'm getting the error: Call to undefined function App\Http\...
1
vote
0
answers
47
views
Wrong transparent backgrund with PHP-GD
I've got a problem with php-gd, I use php-gd to resize png with transparent background file. after that, I put the resized png with <img> and set a background color #wheat on HTML file.
But the ...
0
votes
1
answer
108
views
Black text in generated image after install PHP-GD
I am using imagick to convert generated pdf to jpg/png and save it to server.
All works well but after install php-gd because of use png images in mpdf all text in generated jpg are black.
Here is my ...
1
vote
3
answers
3k
views
How to install ext-gd for php7.4 at scrutinizer-ci config?
After some point, Scrutinizer started permanently failing when trying to analyse Sylius plugins code with next errors:
- sylius/sylius v1.7.3 requires ext-gd * -> the requested PHP extension gd is ...
2
votes
2
answers
7k
views
php-gd installed but fails to function in centos 7 (php 7.3 version)
I am trying to install moodle but it shows php-gd extension is missing/should be enabled.
However the gd is already installed and latest, and when I command php -v I get the following error as ...
1
vote
1
answer
773
views
PHP : imagegrabscreen() not working on PHP 7.2.27
I am using 7.2.27 PHP version with Laravel 7.
Below code working on my local same configuration,
$captured = imagegrabscreen();
imagepng($captured, "~path/" . time() . ".png");
imagedestroy($...
2
votes
1
answer
111
views
Multiple degree color in PHP GD
I'm trying to make a degree color image in the PHP GD library.
I just made a simple code that works fine with 2 colors, but, if I put more than 2, it makes something strange.
My code:
function ...
0
votes
1
answer
4k
views
php 7.3 Unable to locate package php7.3-gd
I'm trying to install the php7.3-gd extension.
When I try to: sudo apt-get install -y php7.3-gd
I recieve the output:
Reading package lists... Done
Building dependency tree
Reading state ...
1
vote
1
answer
2k
views
Unable to locate package php gd Heroku
I'm trying to deploy my project with Heroku and I need to install gd on my server.
My composer file structure looks
"require": {
"ext-gd": "*",
}
When I making composer update i catch the ...
-1
votes
1
answer
77
views
Why is php code not giving the output of image?
this is the code
<?php
$x = imagecreatetruecolor(250, 250);
$y = imagecolorallocate($x, 120 ,156,100);
header('Content-Type: image/jpeg');
imagejpeg($x);
?>
It is giving output as
...
2
votes
1
answer
4k
views
Converting webp to jpeg in with PHP GD Library
I'm having some trouble creating a clean looking image transcode from webp to jpeg using PHP's GD library. As a point of reference Here is a jpeg version of the original using Google's demo here: ...
1
vote
1
answer
486
views
Use font file from S3 bucket with php gd
I am using the PHP GD library for image processing in my Laravel Application.
My application is deployed on AWS Lamda.
I am trying to use custom fonts in GD Library.
The function imagettftext ...
1
vote
2
answers
709
views
Imagecreatefromjpeg returns false even if image is exists
This code returns false:
$image = imagecreatefromjpeg("photos/profiles/original/4cdf149b63d0ca0158f68357d8da371c_y.jpg");
var_dump($image);
exit;
But this code:
$image = ...
0
votes
1
answer
572
views
How can I resize and upload an image for the amazon S3 bucket?
I am trying to resize an image with imagecopyresampled() and at the same time remove the EXIF data from the image with imagecreatefromjpeg() before uploading to S3. I am not sure what I am missing, ...
5
votes
3
answers
328
views
Resizing font size and padding using gd to create a dynamic bar chart
Inspired by this code, I am trying to create a simple bar chart able to dynamically create, resize both bars and texts depends on the the $data, $height and $weight:
<?php
$width = 300;
$height = ...
0
votes
2
answers
693
views
Symfony 3 - Using imagecreatefromjpeg in controller gives an error
I am using Symfony 3 and when I try to use imagecreatefromjpeg function in PHP it gives the following error.
Attempted to call function "imagecreatefromjpeg" from namespace
"AppBundle\Controller"
...
19
votes
5
answers
3k
views
PHP wrong result for imagetruecolortopalette with PNG with transparency
I'm trying to write a PHP script that resizes a PNG image and then converts it to PNG-8 bit mode. So the size of the resulting file will be smaller but without too much quality loss.
The resize works ...
4
votes
1
answer
1k
views
Compress & resize images using PHP GD lib not working for png and weird results for jpg
I am trying to compress & resize my images using the php GD library. Nearly every answer on SO and everywhere else is the same, but for my solution, the PNG's are not being correctly transformed, ...
0
votes
0
answers
54
views
Cropping logic results in black image
Struggling to get the math correct for image cropping, hoping someone else is able to see my issue. It appears to be overshooting the dimensions of the image leaving 1 pixel of the original image on ...
3
votes
3
answers
2k
views
How to install php5-gd in Wheezy Debian php 5.6
2 of my sites are not working bcs I can't install php5-gd library to Debian Wheezy php5.6 ...
I tried
aptitude install php5-gd, and system said i miss 2 dependencies, which i can not find or ...
0
votes
0
answers
539
views
Website throws "PHP-GD not installed" but it is installed
I wanted to make a Teamspeak Bannerbot, i downloaded a rar and now the website says, that php-gd isnt installed. After i installed it the same error came. Here you can see the index.php code, were it ...
15
votes
2
answers
34k
views
Unable to locate package php7.3-gd
I get the error from my cakephp 2.x project:
The PHP GD extension is required, but is not installed.
I use php7.3 with apache on debian
I search and find
apt-get install php7.3-gd
I tried this but ...
3
votes
0
answers
1k
views
how to fix php-gd failing to install debian
i know this question has already been asked, but it didn't have an answer that worked for me and i cannot comment as i do not have enough reputation.
I'm not able to install php-gd extension on my ...
5
votes
1
answer
5k
views
Internal gd font () not available use only 1-5
I am using Laravel framework and image/intervention library for generating images with dynamic data. The code is running perfectly fine on my local machine but as soon as I upload it on aws ubuntu ...
1
vote
3
answers
417
views
Colorize PNG using PHP GD
I want to colorize some PNGs using PHP GD. For testing purpose i hardcoded the color red (255,0,0) which later will be replace by a dynamic variable.
For example i have these two images:
Image 1:
...
1
vote
1
answer
3k
views
php7.2-gd can't find package (tried everything)
I have Ubuntu 14.04 and php7.2 but can't install php7.2-gd
I need to install package php7.2-g
when i run apt-get install php7.2-gd it says that:
E: Unable to locate package php7.2-gd
E: Couldn't ...
1
vote
0
answers
250
views
Resizing images via nginx imagefilter vs php gd. Which is better?
I want to know which will consume more cpu resources?
Resizing and serving image live via image_filter module in Nginx
Or
Resizing and serving images live via PHPGD in PHP Script
Since both use GD ...