gd

imagecopy doesn't work all the time

帅比萌擦擦* 提交于 2019-12-13 14:53:52
问题 I'm having an issue with imagecopy certain images on the $url variable will not appear even though there both PNG on the working and not working examples. The $local variable loads transparent images from the server and $url variable loads from a remote server. I have inculded a test transparent image for $local . Working: <?php header("Content-type: image/png"); $url = imagecreatefrompng("url_removed.png"); $local = imagecreatefrompng("http://url_removed.png"); imagecopy($url, $local, 0, 0,

Displaying right to left connected languages (like persian and Arabic) in GD - Possible PHP bug

余生长醉 提交于 2019-12-13 14:53:07
问题 I want to create an image with a text on it with php gd library. everything is fine, but when I try to write a word from a right to left connected language (like Persian ) using imagefttext() , my text is rendering from left to right (inverse) and the chars are not connected any more . example of connected chars : ماه example of not connected chars : م ا ه Here is my code : header('Content-Type: image/jpeg'); $thumb_path = "..."; $font_path = "..." $img = imagecreatefromjpeg($thumb_path);

PHP: imageftbbox

一个人想着一个人 提交于 2019-12-13 13:43:02
问题 What is the application of a bounding box of a text in PHP imageftbbox ? In the example of the manual, it was used to determine the coordinates for the imagefttext function. Is it necessary? Maybe I am missing something here. ... // First we create our bounding box $bbox = imageftbbox(10, 0, $font, 'The PHP Documentation Group'); // This is our cordinates for X and Y $x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) - 5; $y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5; imagefttext(

What is the correct way to determine text coordinates a from bounding box?

淺唱寂寞╮ 提交于 2019-12-13 12:03:26
问题 Given the result of a call to imagettfbbox(), what is the correct, pixel-perfect point to provide to imagettftext() such that the text will not extend beyond its bounding box? I am determining the width/height and x/y of the baseline from the bounding box like this: $box = imagettfbbox($size, $angle, $font, $text); $boxXCoords = array($box[0], $box[2], $box[4], $box[6]); $boxYCoords = array($box[1], $box[3], $box[5], $box[7]); $boxWidth = max($boxXCoords) - min($boxXCoords); $boxHeight = max(

resizing image function implementation inpage

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 08:11:30
问题 resize.php <?php function resizeImg($new_width, $new_height, $get_image, $quality){ ini_set("allow_url_fopen", 1); list($old_width, $old_height) = getimagesize($get_image); $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($get_image); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height); header('Content-Type: image/jpeg'); imagejpeg($image_p, NULL, $quality); } $new_width = $_GET['w']; $new_height = $_GET['h']

Can GD make text appear warped (made to look like it wraps around a curve slightly)?

*爱你&永不变心* 提交于 2019-12-13 06:41:03
问题 I am placing some text over an image using PHP's GD library. The background image is a ball. Ideally, the text should warp slightly to look like it is on a curved surface. It should be largest in the middle, and scale slightly smaller on each end (text is not known before hand either, but there is a maximum length of 15 chars). Is this possible, or do I need to use a better library than GD? Thanks 回答1: For image effects, I suggest you look at Imagick. Although it's possible in GD, you need to

GD, libJPEG loaded, imagejpeg returns false

主宰稳场 提交于 2019-12-13 06:11:31
问题 I'm having a strange behavior with PHP, GD, and libJPEG Here is my phpinfo() for GD: GD Support enabled GD Version bundled (2.0.34 compatible) GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version 8 PNG Support enabled libPNG Version 1.2.44 WBMP Support enabled XBM Support enabled This is what I'm doing : $img = imagecreatefromjpeg("/home/logo.jpg"); var_dump($img) Result is false. Image exists, and is chmodded 777. I'm running php 5.3.9, also make test

php GD Library imagecopyrezised()

瘦欲@ 提交于 2019-12-13 05:16:51
问题 I am using the following line to resize an image file: imagecopyresized($dst_image, $dst_image, 0, 0, 0, 0, 1000, 750, $src_w, $src_h I am expecting the values of 1000 and 750 to be the dimensions of the new image file, but instead, an image is being created with the same dimensions as the original file, and copying a section of this image back onto it. Could anyone help? 回答1: You should create a new image source and copy the image in there: $resized = imagecreatetruecolor(1000, 750);

Why is Content-Type: image/jpeg header not working? [duplicate]

£可爱£侵袭症+ 提交于 2019-12-13 05:02:52
问题 This question already has answers here : Image can not be displayed because it contains error in php gd (3 answers) Closed 5 years ago . I'm using GD library to resize image. Why is not header('Content-Type: image/jpeg'); working? It gave me an error as you can see in pic below: Here are my GD details: . <?php header("Content-type: image/jpeg"); if(isset($_GET['image'])){ $image = $_GET['image']; list($image_width, $image_height)= getimagesize($image); $new_size = ($image_width+$image_height)

Image processing class in PHP

旧城冷巷雨未停 提交于 2019-12-13 04:43:35
问题 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 of my class and I pass in either a URL of a photo, or the path to a local photo being uploaded using POST form. 2) I then need to take the main image and check it's dimensions, if it is wider the 800 pixels, I need to resize it down, if it is not