I want to add a small functionality to my site wherein a user can upload his pic and then on selecting a specific color(basically on clicking something) a splash effect of that color gets added to that image.
The user should then get an option to save that image.
Is it possible using the php GD library? Any helpful comments are welcome.
Edit: What if i create the images for these effects? how can i overlay them on the user's pic and then offer the complete image as a download?
The simplest way to achieve this is to create the effect in another image and just use PHPs GDlib to copy that image on the image uploaded by the user and change the color.
You can use imagecopy or imagecopyresized or imagecopyresampled. Depending on the image you are using you could for example use imagecolorset to change the color of the effect.
The full list of PHPs image functions is in the PHP manual.
Use of the GD library might work here, but this is something that ImageMagick was built for. I'd look into using that, as it's almost as ubiquitous.
Just use the original image as a background image, and add on top of that a full sized fill of a colour at a reduced opacity.
http://us2.php.net/manual/en/function.imagecolorallocatealpha.php
Related
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 tried a lot but cannot find it out.. I have found watermarked script. But i did n't find a script where i can select a region from a picture and blur it..
I am using PHP Script for that.
Please help...
Thanks
Using any of the various PHP image solutions out there (such as GD or ImageMagick) you should follow these steps:
First, create a duplicate image, and crop it to the are you wish to blur. Second, use some technique to do the blurring - this could be a literal blur, or be shrinking and expanding the image to create pixellation. Finally, overlay the blurred image back onto the original image in the correct location.
I'm working on a web application that need to allow the user to drag and drop as well as rotate an image.
Drag and drop is solved with the jQuery UI Draggable.
But how am I suppose to rotate an image on the page? My images are mostly one colored rectangles. I used divs to draw them on the page but how to rotate them?
It is okay if they only rotate 22, 5-45-67, 5-90 degrees
So I think of 3 solutions
Using Canvas
Problem: IE support
Using divs
Problem: it also needs canvas to rotate
PHP GD
This solution is the only hope that left.
How it might work: The application will prerender (22,5*x) rotated versions of original image. So they will be ready whenever user wants to rotate an image.
Please help. Any suggestions appreciated
One possible solution is to use a JavaScript graphic vector library that can use automatically an alternative to canvas when used on IE.
Raphael is a really good one, give it a try:
http://raphaeljs.com/
You can find more informations about rotation with raphael here:
How do I rotate a div with Raphael.js?
take a look:
http://www.dyn-web.com/code/rotate_images/
Rotate image clockwise or anticlockwise inside a div using javascript
The server side method sounds a bit wasteful (all versions of the image need to be downloaded), dare I say you should try using Flash for a cross-browser and client side solution.
You cannot manipulate image directly with Javascript other than resizing them (and this is technivally done with CSS, not Javascript...). The best solution would be to use Raphaƫl; it will allow you to ratate, but also drag and drop, and it is also built using JQuery.
Of course you could alternately use different image states and use them as "sprites" for your rotated rectangles, however you will not play extensibility there. (GD is a bad design, don't use that.)
How to include an image inside another image in PHP? I want to do it like in twitterbackgrounds.com personalized backgroud. there is one main image and we can upload four personal images after that it will show as watermark of the main image.
I never used GD by myself, but look at the example in the manual, wich is about "Using imagecopymerge() to create a translucent watermark".
Well, there are several possibilies to do that. The one that pops into my mind is to use a php page where you can upload all files needed for this. After submission you can use imagemagick to create the new image with watermarks and display it on another webpage or store it to a database.
Here is a good tutorial on how to use imagemagick to create the watermarks in another image.
you may use imagemagick as commandline command from php or use it as a server application on an own server
phpThumb has a watermark feature, if you're looking for something full-featured and ready-made..
i work in lamp environment .
i search script that know to take a image , that user upload to my site.
and make from this image , new image that contain the real image with small stamp on the top corner.
thanks
your best bet would be to look here it is an ideal script provided by the PHP.net user guide. Just make sure that you have the GD library installed
You'd want a watermark which can be accomplished with GD
What you are describing is "watermarking". There are tools out there to do this, a lot of image manipulation packages have this feature.
A search for this might lead you to something useful.
Have a look at these PHP tutorials:
Using imagecopymerge() to create a translucent watermark
Adding watermarks to images using alpha channels