Php graphics library

Hi there;

I need a library for a PHP project of mine, which I intend to make a badge for an avatar of a user. Could you provide a library for this?

Kind regards.
LVL 12
jazzIIIloveAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Uhh, not sure I understand the question.  Do you have the PHP GD library installed?  You can use this script to see what is included in your PHP installation.

<?php phpinfo();
jazzIIIloveAuthor Commented:
What I want to do is that suppose that I have an avatar/pic that I want to put a small pic in the very corner of it, that the users should be able to do it. So is it possible with GD?

Any example codes  manipulating a pic would be perfect.

Kind regards.
Ray PaseurCommented:
Sure it's entirely possible and many web sites do it all the time to watermark copyrighted images.   Please post an example of the images you want to combine and I'll show you exactly how to do it.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

jazzIIIloveAuthor Commented:
Sure;

You may need to resize the photos.

But the issue is that I want the user to assign the badge to the avatar.

Looking forward to your message

Kind regards
untitled2.bmp
wallpaper-113696.jpg
Ray PaseurCommented:
OK, I have the two photos.  One is girls-and-minarets (604x256).  One is anime-paper (1600x1200).  What do you want to do with these images?  Which goes where and how large?  It's easy to do but we need to have some fairly clear instructions about how to handle these.  An example might be, "Take the anime-paper, make it 160x120 pixels and put it over the upper-left corner of girls-and-minarets."

Also, I do not know if this matters to you, but PHP GD library is very competent with JPG and PNG images, but does not work well with BMP images.  I have come to prefer PNG images for everything I do because they do not suffer from "lossy" compression like JPG images.  PNG images have some compression, though not as much as JPG images.  But the fact that they can be stored and transmitted without losing image quality trumps the compression, in my opinion.
jazzIIIloveAuthor Commented:
The girls will be going to the left hand side of the anime. Any size.

Ah, you can convert the image type to whatever you want

I am flexible by all means.

How can we do this in php?

Regards.
jazzIIIloveAuthor Commented:
left bottom.
Ray PaseurCommented:
http://www.laprbass.com/RAY_temp_jazzIIIlove.php
<?php // RAY_temp_jazzIIIlove.php
error_reporting(E_ALL);

// LOCATION OF THE IMAGES (COULD COME IN FROM $_GET URL STRING)
$original = 'http://www.LAPRBass.com/RAY_junk/anime.png';
$overlay  = 'http://www.LAPRBass.com/RAY_junk/girls_minarets.png';

// READ THE IMAGE AND THE OVERLAY FILE
// MAN PAGE http://php.net/manual/en/function.imagecreatefrompng.php
$im = ImageCreateFromPNG($original);
$wm = ImageCreateFromPNG($overlay);

// ADD OVERLAY USING LOCAL FUNCTION
imagelogo($im, $wm, imagesx($im), imagesy($im), imagesx($wm), imagesy($wm));

// SHOW THE IMAGE
header('Content-type: image/png');
ImagePNG($im);

// A FUNCTION TO ADD THE OVERLAY
// SEE http://php.net/manual/en/function.imagealphablending.php#77085
function imagelogo (&$dst_image, $src_image, $dst_w, $dst_h, $src_w, $src_h)
{
    ImageAlphaBlending($dst_image,TRUE);
    ImageAlphaBlending($src_image,TRUE);
    ImageCopy
    ( $dst_image
    , $src_image
    , 0
    , ($dst_h-$src_h)
    , 0
    , 0
    , $src_w
    , $src_h
    )
    ;
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jazzIIIloveAuthor Commented:
Classic Ray!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.