gd

How can I write Non English Characters such as Arabic or Persian characters into an image?

你说的曾经没有我的故事 提交于 2019-12-28 17:30:49
问题 How can I write Arabic or Persian characters to an image using PHP GD library? i.e. "احسان" 回答1: Use this function in order to pass text to imagettftext <?php function revUni($text) { $wordsArray = explode(" ", $text); $rtlCompleteText=''; for ($i = sizeOf($wordsArray); $i > -1; $i = $i-1) { //$lettersArray = explode("|", str_replace(";|", ";", $wordsArray[$i])); $lettersArray = explode(";", $wordsArray[$i]); $rtlWord=''; for ($k = sizeOf($lettersArray); $k > -1; $k = $k-1) { if (strlen(

PHP watermarking

我怕爱的太早我们不能终老 提交于 2019-12-28 12:43:13
问题 i am using this code to create watermark. $image = '1.jpg'; $overlay = 'stamp.png'; $opacity = "20"; if (!file_exists($image)) { die("Image does not exist."); } // Set offset from bottom-right corner $w_offset = 0; $h_offset = 100; $extension = strtolower(substr($image, strrpos($image, ".") + 1)); // Load image from file switch ($extension) { case 'jpg': $background = imagecreatefromjpeg($image); break; case 'jpeg': $background = imagecreatefromjpeg($image); break; case 'png': $background =

GD! Converting a png image to jpeg and making the alpha by default white and not black

≡放荡痞女 提交于 2019-12-28 10:45:13
问题 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 = imagecreatefrompng($upload); $background = imagecolorallocate($old,255,255,255); imagefill($old, 0, 0, $background); imagealphablending($old, false);

GD! Converting a png image to jpeg and making the alpha by default white and not black

岁酱吖の 提交于 2019-12-28 10:45:12
问题 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 = imagecreatefrompng($upload); $background = imagecolorallocate($old,255,255,255); imagefill($old, 0, 0, $background); imagealphablending($old, false);

PHP GD: How to get imagedata as binary string?

夙愿已清 提交于 2019-12-28 05:43:25
问题 I'm using a solution for assembling image files to a zip and streaming it to browser/Flex application. (ZipStream by Paul Duncan, http://pablotron.org/software/zipstream-php/). Just loading the image files and compressing them works fine. Here's the core for compressing a file: // Reading the file and converting to string data $stringdata = file_get_contents($imagefile); // Compressing the string data $zdata = gzdeflate($stringdata ); My problem is that I want to process the image using GD

Odd transparency effect when merging two .png's with transparency in PHP-GD

╄→尐↘猪︶ㄣ 提交于 2019-12-25 17:03:26
问题 Merging two images with transparent sections produces the following composite image: I'm wondering why the transparent section of the image I've overlayed onto the green background shows up as such? Anyone? $base = imagecreatefrompng('application/assets/images/vel1_bg.png'); imagealphablending($base, false); imagesavealpha($base, true); list($baseWidth, $baseHeight, $type, $attr) = getimagesize('application/assets/images/vel1_bg.png'); $user_board_items = $this->config->item('user_board_items

Redhat Linux 6.5 Perl GD CPAN Module yum

天涯浪子 提交于 2019-12-25 12:32:34
问题 when i try to install "GD" (perl -e shell -MCPAN ->(next step) cpan[1]> install GD) on Redhat 6.5 i got the error: -> CPAN.pm: Building L/LD/LDS/GD-2.53.tar.gz UNRECOVERABLE ERROR Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher. If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd. Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site] CPAN: YAML loaded ok (v0.90) LDS/GD-2.53.tar.gz /usr

Redhat Linux 6.5 Perl GD CPAN Module yum

我与影子孤独终老i 提交于 2019-12-25 12:31:05
问题 when i try to install "GD" (perl -e shell -MCPAN ->(next step) cpan[1]> install GD) on Redhat 6.5 i got the error: -> CPAN.pm: Building L/LD/LDS/GD-2.53.tar.gz UNRECOVERABLE ERROR Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher. If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd. Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site] CPAN: YAML loaded ok (v0.90) LDS/GD-2.53.tar.gz /usr

PHP-gd text display in Japanese is weird

流过昼夜 提交于 2019-12-25 09:36:16
问题 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 instead (very different, looks like Chinese). Could it be an encoding issue? Using PHP 5.3.3 on RHEL 5.4. 回答1: Well, japanese as a multibyte encoded language has quite a

how to automatically copy an entire directory as thumbnails using phpthumb (or some other library)

狂风中的少年 提交于 2019-12-25 08:01:01
问题 I would like all images dropped in a directory to be copied into a separate directory as thumbnails that i can then view on my site. Right now i'm researching phpthumb, but have also downloaded wideimage and zen photo. Thanks if you can find an exact duplicate to this, near matches may also be helpful. Here is the script that only copies a single files: require_once '../ThumbLib.inc.php'; //include the thumb library $thumb = PhpThumbFactory::create('test.jpg'); //create a new image from the