Box of text in php gd - php

I want to make box of text having story in it...copy on image using GD library.i want it beacause i have to save image for further puporse.

Start by looking into imagettftext and what you'd need to get that working. For example, this site.

Related

PHP image manipulation wrapping image on of another image

I'm working on a PHP project where the user can upload an image and preview that image on a product (Ex. mug, pillow). I have done almost all that is required to implement this except wrapping the uploaded image around the product image. I have done extensive search on that, but could not find any help. Could anyone show me the way please ?
At the moment I am using the GD library.
Best example for what I need is : http://www.zazzle.com/polyester_throw_pillow_16_x_16-189271445174968378
I am not sure how they are doing that.
EDIT :
My area of interest is how they are blending the image according the product shape
I think it's answered here: Merge two PNG images with PHP GD library
Just make sure that the image uploaded by the client is smaller than your product image

How to add a text with font to an image using jquery and PHP

I want to add editable text (with font selection) to an image using jquery and want this to be saved as a new image.
Can someone give me some examples or opensource tools for this?
To Explain further, jquery would be used to write text and select font over an image and in the server side PHP can be used to save the new image. I have already developed some server side coding to do the same but looking for a jquery solution for the front end.
The only way you can do this is to use canvas and "save as image", but canvas is not well supported - so if a public website then not recommended. Link: http://www.html5canvastutorials.com/advanced/html5-canvas-save-drawing-as-an-image/
Otherwise you need to do as two separate actions - write the text for display as jQuery, then recreate the image using GD library in PHP. You'll struggle to get them identical, but they can get pretty close.

Add watermark to images

I've searched for ages for a solution, but I can't really find the solution to fit my needs.
So here's the story. Im creating a website and I really want to add watermarks to the downloaded images.
Yesterday I was browsing in a website called 9gag. If you haven't heard this website before, its a comic based website, and I found out that when you download an image, or access an image from anywhere else except their website, there's a 'watermark/banner' at the bottom of the image.
For example take this image:
link , notice no banner at the bottom of the image.
If you right-click, 'Copy image URL' , you get this link: image . See the banner now?
Im very confused on how they do it, and it would be great if we could use this on our websites.
Anyone with any ideas? Is it using any type of CGI?
P.S: I Wasn't sure what tags to add, So if anyone knows a better tag combination, please do edit it.
This effect is just a css trick. The image itself actually contains the watermark at the bottom, but the image tag is wrapped in a block that hides (overflow:hidden) the bottom 42 pixels of the image when it's being displayed in the page.
There are other things you can do that are more sophisticated (for instance, have the image served via a php script and comparing the http referer
header("content-type: image/jpeg");
if (!isset($_SERVER['HTTP_REFERER'])){die("alert('Restricted Access!');");};
$_u=parse_url($_SERVER['HTTP_REFERER']);
$_u=preg_replace("/(www.)/i","",strtolower($_u['host']));
$_i=$_SERVER['HTTP_HOST'];
$_i=preg_replace("/(www.)/i","",strtolower($_i));
if ($_u != $_i){
//handle this with gd or redirect
}
) but this will only work if someone tries to load the image from a different website or if they go to the image url... generally save-as will save the image from the browser's cache, so the css trick might be the best option you have (or a combination of these options). Fundamentally keep in mind that anything you show on the web can be captured (the code above isn't foolproof, and you can always prtsc).
GD library of php will help you doing that.
You'll need to create a new image using imagecreate function but adding some more "space" to the original size. Example: if I have an image of 200x200 (which you can retrieve using gd functions too) you'll need to create a 200x220px image using that function
Fill the new image with that gray color using imagefilledrectangle function
Copy the original image into the new one using imagecopy
Set the header's content type to image/type png gif etc..
Output to the image using imagepng or any other function that has the format you want.
I've had success with JQuery Watermark:
Jquery Watermark

Overlay text on background image and convert to one image

i want some suggestions.
i have to do customize image banner means i have to customize text on images.
for example there is a text on image. this text can customize.after submit this background image and text total convert into one image
Have a look at imagefttext/imagettftext and imagecreatefrompng/imagecreatefromjpeg (or the corresponding function you need).
To create an image from a text, you can use the imagemagick library http://www.imagemagick.org/script/convert.php

PHP/JS: Profilephoto resize and cutting

Hi i just went on a site, when you press "upload image" a lightbox comes up, and then it says upload image, you browse find a image and then you press submit. After that, it shows your image with a square that you can move around and make bigger smaller /width/height.. so you like cutting. After that you can save, and you now have a new avatar.
What have they done for doing that?
Is there any library or so to do this? Would like to have that on my webpage.
Look at PHP GD library imagecopy on how to crop images via PHP.
They are likely using a Jquery + the GDLibrary or Imagick Library for PHP.
They used something called jCrop in jQuery.
http://deepliquid.com/content/Jcrop_Manual.html

Categories