gd

CSS: Set font to a size so the text would occupy whole container [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-04 05:02:01
This question already has answers here : Closed 8 years ago . Possible Duplicate: resize font to fit in a div (on one line) For a small flashcard maker app I need to set the correct font size so text would fill all the available width of a fixed-size container; like the text in the four boxes in this picture: A solution using PHP GD has been provided to this question . Is there a client side solution with css or javascript to this problem? it's not brute force ;) HTML: <span id="txt">Lorem</span> <div id="card"></div> CSS: #card { width: 150px; height: 50px; border: 1px solid black } #txt {

How to install GD on Heroku

99封情书 提交于 2019-12-04 04:54:32
I am running Laravel 5.3 and trying to do some image manipulation. I get this error: GD Library extension not available with this PHP installation. I've tried putting gd in my composer.json "require": { "php": ">=5.6.4", "laravel/framework": "5.3.*", "mews/purifier": "~2.0", "vinkla/hashids": "^2.4", "barryvdh/laravel-debugbar": "^2.2", "fzaninotto/faker": "~1.4", "intervention/image": "^2.3", "gd": "*" }, and it didn't work. I also tried: "ext-gd": "*" and that didn't work either. I looked at this page https://devcenter.heroku.com/articles/php-support and it says: The following built-in

Does the GD library use a lot of memory?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 03:25:44
I want to use GD library in my PHP script to generate a small thumbnail of a random big picture from external server. Every time the page is called, the GD library will regenerate a thumbnail and show it. Will this slow down the server or use up an unusual amount of memory? GD use a lot of memory. It loads the image into memory entirely and uncompresses it, so you will need at least 32 bits per pixel. An image with the size 800 x 600 do then use up: 800 * 600 * 32 bits = 15.4 megabit = 2 MB This is only to load the image. I have heard that it will use the double of this if you do resizing, and

Looking for GD tutorial in C/C++ [closed]

一曲冷凌霜 提交于 2019-12-04 03:12:15
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I see a lot of GD tutorials for PHP, even though GD was written in C, not PHP. Could you please suggest any good tutorial for GD in C? A bit of googling turned up nothing for me either - this is one of those things, for now anyway, that you must study the API reference and make up your own toy test programs. I'm making this, which might reasonably be a comment, an answer so that it doesn't get lost

In PHP, imagepng() accepts a filter parameter. How do these filters affect the function's output?

[亡魂溺海] 提交于 2019-12-03 23:33:47
How do these filters affect the output of imagepng() in PHP? PNG_NO_FILTER PNG_FILTER_NONE PNG_FILTER_SUB PNG_FILTER_UP PNG_FILTER_AVG PNG_FILTER_PAETH PNG_ALL_FILTERS The documentation simply says, "A special PNG filter, used by the imagepng() function" for each of them. It seems that using PNG_NO_FILTER will reduce the filesize of the output, but other than that, I am unsure as to how it is affected. Any insight would be really appreciated. According to the PNG Specifications at http://www.w3.org/TR/PNG-Filters.html The purpose of these filters is to prepare the image data for optimum

Create Image from Data URL

扶醉桌前 提交于 2019-12-03 21:42:04
What I was hoping to do was use the JavaScript "readAsDataURL" method of the "FileReader" object in order to read file input from a drag and drop. Then I wanted to use Ajax with a PHP upload file in order to create a file and upload it to an "uploads" folder on the server. I was wondering if there was a function in GD or something that would allow me to read in a data URL and output a file in which I could move to that folder. A data image URL will usually be base64 encoded, and will then contain a JPG, GIF, or PNG image which you can store. So a simple base64_decode() should do to turn the

Resize image and display without saving it

≡放荡痞女 提交于 2019-12-03 21:27:31
问题 I've built an image gallery and saved the image "as is" without cropping it. I want to resize the image on the fly while it's loaded in the controller, so when I load the controller in the browser it displays the image re-sized to whatever I want. I've added the method to MY_Loader , here is the code. function show_image($image, $width, $height) { $this->helper('file'); $image_content = read_file($image); //resize image $image = imagecreatefromjpeg($image); $thumbImage = imagecreatetruecolor

Combine two images (.JPG) using PHP GD

狂风中的少年 提交于 2019-12-03 16:16:55
I can't find a solution to this. I want to add 20px empty space to this image: http://img233.imageshack.us/img233/419/78317401.jpg and then paste this watermark at the bottom (on the blank space) So the output would be: http://img252.imageshack.us/img252/4554/wynik.jpg I don't want to stretch it. EDIT Did it with WIdeImage. Rly simple. Try wide image api http://wideimage.sourceforge.net/ Check out one of their this demo may be that help you Merge and Resize 1) Load both images with http://www.php.net/manual/en/function.imagecreatefromjpeg.php 2) Get 1st image height and width with http://www

sharpen image quality with PHP gd library

若如初见. 提交于 2019-12-03 15:59:40
not sure where but I came across as image hosting site that allows you to upload your image in a large format or to sharpen it. I personally do not recall or know of any functions of GD library to sharpen image which might just be a different word for quality being up-ed. If some one knows of a function to sharpen images please tell me since personally I am not aware of such functions neither in Image Magic and/or GD Library. Thanks in advance You'd use imageconvolution() with a matrix that corresponds to a sharpen filter. Details in this comment on the PHP site: http://php.net/manual/en/ref

Why rand() isn't really random?

◇◆丶佛笑我妖孽 提交于 2019-12-03 14:17:15
I wanted to put random points on an image (stars in space for some little fun side project) I have this simple script. <?php $gd = imagecreatetruecolor(1000, 1000); $white = imagecolorallocate($gd, 255, 255, 255); for ($i = 0; $i < 100000; $i++) { $x = rand(1,1000); $y = rand(1,1000); imagesetpixel($gd, round($x),round($y), $white); } header('Content-Type: image/png'); imagepng($gd); ?> Keep in mind this is just for testing, that is why I put 100000 in for loop so it shows the pattern I noticed emerging. We have 1 million pixel to use, still random X and Y creates this pattern instead: So it