How to add a logo on top of a image using an upload script?

Discussion in 'PHP' started by stevenhartley, Feb 10, 2012.

  1. #1
    Hey everyone,

    Hopefully someone can help me here. :)

    I have an upload script on my website:
    http://www.sportingprofiles.com/add_a_sporting_profile.php

    For every image that gets uploaded I want it to have my logo on, how is this possible and what filesize do I need to save the logo as in order for it to go on the image?

    Thanks,
    Steve
     
    stevenhartley, Feb 10, 2012 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Use GD or imagemagic. Make sure your php installation has GD compiled before trying to use any GD functions. Otherwise, it's pretty easy. You will want to load the uploaded image and then copymerge your own image onto it. Do a search for GD watermark. You should be able to find a number of tutorials on how to accomplish it.
     
    jestep, Feb 10, 2012 IP
  3. vruvishal

    vruvishal Member

    Messages:
    22
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #3
    you can use php GD library....
     
    vruvishal, Feb 11, 2012 IP
  4. vanitymarketing

    vanitymarketing Greenhorn

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    yes GD library works fine... you have to contact your host about your options... they usually have imagemagick and GD active on their servers...
     
    vanitymarketing, Feb 11, 2012 IP
  5. stevenhartley

    stevenhartley Active Member

    Messages:
    977
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Thanks for your help people, the only problem now is the background of the logo isnt transparent over the image, what file should it be saved as?
     
    stevenhartley, Feb 13, 2012 IP
  6. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #6
    Usually a carefully planned PNG is the best way to go. I don't think GD or image magic support vector based images so it may be difficult to get a good overlap without the edges being messed up.
     
    jestep, Feb 13, 2012 IP