add logo

Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?

Moderator: General Moderators

Post Reply
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

add logo

Post by elecktricity »

I was wondering if it was possible to have an image in like 'images/01/01.jpg' and put it on a page but with a graphic logo on it, I know it's possible to add text to it, but is it possible to add a graphic? if so can I get a link?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm having real trouble trying to figure out what you are talking about. :?
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post by Nathaniel »

Do you want PHP to dynamically add an image onto the top of another image?
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

Post by elecktricity »

Nathaniel wrote:Do you want PHP to dynamically add an image onto the top of another image?
yea that, sorry if I didnt make sence, I have a hard time explaining things.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I still dont' understand??? you mean you want it layered on top, or you want to "morph" two images together?

if the former, look into absolute positioning of page elements...if the latter, ask onion2k about GD :D
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

Post by elecktricity »

not really sure what you mean by 'morph' but I want it for 2 images to be like layered on there into 1 image
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

morph as in merging the 2 images together.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

Put it this way. You basically want to stack the pancakes?

Corny but it works.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

http://www.ooer.com/index.php?section=php&id=9

My "Starting out with GD" article .. instead of creating a new image as I did in the article you'll need to open an existing one, and then open your logo image .. so you'll have two image handles open .. then use the imagecopy() function to copy the logo onto the first image. Copying an image onto another image is covered on page 2 of the article.

Gets more complicated if you need to preserve transparency.. if you need that then ask and I'll follow up here ..
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

Post by elecktricity »

thanks guys, links are muchly appreciated.
Dm7
Forum Commoner
Posts: 67
Joined: Sat Oct 08, 2005 9:16 pm
Location: USA

Post by Dm7 »

Here's my function example with transparent support...
Mind me, I'm making a function without testing it out, but it SHOULD work!
Be sure to set $overlay path properly.. here's the example...

Code: Select all

$overlay = "/var/www/vhosts/domain.com/httpdocs/gallery/Copyright.png";
How to use function

Code: Select all

overlayim("/var/www/vhosts/domain.com/httpdocs/gallery/Copyright.png");

Code: Select all

function overlayim($overlay) {
// Checks if overlay image exists

	if (!$overlay = imagecreatefrompng($overlay)) {
		$error = "error opening overlay image";
		$show = "error";
	}
//open original (uploaded) image, based on type.
		switch($_FILES['file']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['file']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['file']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['file']['tmp_name']);
				break;
			default:
				$error = "Unknown File Format or MIME Type";
				$show = "error"; } 
			
                if ($orig) {
	
			
			// fetch the size of the original and overlay images,
				
		$width = imagesx($orig);
		$height = imagesy($orig);
		$overlay_x = imagesx($overlay);
		$overlay_y = imagesy($overlay);
		
				// Calculate offsets for overlay (top right)
			
			$offset_x = $width - $overlay_x;
			$offset_y = 1;				
			
				// Set the transparent color in the overlay, and copy
				// it into the new image.
			imagecolortransparent($overlay);
			imagecopymerge($orig, $overlay, $offset_x, $offset_y, 0, 0, $overlay_x, $overlay_y, 75);
}
From what I have seen, it should work, but if it doesn't.. let me know please. However, you should get an idea how it works. Be sure to have a png file with alpha channel for imagecolortransparent to work. :)
Post Reply