I'm creating a comments system for my 'CMS' and would like to implement avatars. I would like to have a "getavatar.php" that uses a GET request to find an image for a certain user, while also doing some image processing.
Could anybody point me in the right direction for outputting data as "image/png" from a php script?
An example of this would be http://placehold.it/300x300 in the way it generates a 300x300 png image from the parameters given in the URL.
To output an image using PHP: Output an Image in PHP
To resize or edit an image using PHP: resize image in PHP
Both answers contains a lot of useful functions. Hope this help you.
Related
While I was looking for some info, I came across this image on a forum which i didn't understood how it worked. Its a JPG image which actually tells you your ip address and your browser. I think that maybe it was made by modifying htacess and replacing PHP for JPG, and with PHP generating the image dynamically but I'm not sure about it.
Would this be the way that this works?
Here is the image i saw:
http://www.danasoft.com/sig/475388.jpg
Thanks
It is nothing but etching text on image. There are several options to do it. Using PHP see here and Java see here
yes this image is generating dynamically. It collects your info make a string and use some library to generate that image like in Captcha. php has its own library too for this purpose
Click here
I will create a dynamic page with content added and rearranged by JavaScript. Is it possible to create a jpg image of this content? - let's say, everything that is inside the container div will be generated to an image. If so, could anyone give me some good tips of this technique?
The traditional method is to run a "headless browser" on your server, "browse" to that url, and take a screenshot. It can be done to some accuracy on the client side in HTML5 browser, see this discussion:
Using HTML5/Canvas/JavaScript to take screenshots
This question may help:
Using HTML5/Canvas/JavaScript to take screenshots
and then this one:
convert canvas to jpeg image
The sequence of your algorithm would be something like:
create screenshot using canvas
convert the canvas screenshot to a
JPG file
How to Rotate, Edit , Add Text to an image and Save it to local folder like a image editor Based on php and java script. I already tried image rotation in PHP Image Creator. But it reduces the image quality too much. If anybody knows idea to do that please share here.
Thanks
Use canvas. Here is a tutorial for the rotation.
I'm creating a web app that allows users to specify an image url to display an image along with their submission.
To avoid some potentially large images and odd sizes, i'd like to use PHP to limit/resize the image before it gets output to the browser (I know i could use max-width in CSS but this is unnecessary downloading)
Is this possible?
PHP has a library named GD. It's fairly easy to check the size of an image with the getimagesize() function.
You can find the complete code for it with 2 module/extensions: http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/
a comparison of them can be found here: http://dreamfall.blogspot.com/2008/02/php-benchmarks-gd-vs-imagemagick.html which may be of use if you want optimize features.
I am using this Image Upload and Cropping with PHP and Jquery: 9lessons.info Maybe someone can give me please PHP script or link to script that allows me upload image from URL?
I've found that re-sizing images using GD can be buggy, especially when you're dealing with transparency. It could also just be that your script bugs out after it's created the image but before it's copied any data into it.
Go over it step-by-step and see when the image turns black.