Page 1 of 1

Adding mail-to function

Posted: Wed May 25, 2005 5:21 pm
by SMR
I have an image generator and am looking to add in a mail-to function to it.
I would like to be able to email the image from the resulting page...
Here is what the final page code is...

Code: Select all

<?php

$fontpath = "$DOCUMENT_ROOT/phpBB/weblogs/banner/fonts/";

$titlefont = "$fontpath/$titlef";

$tagfont = "$fontpath/$tagf";





if ((isset($titletext) || $titletext > "")

		and (isset($tagtext) || $tagtext > "")) {

	$titlecolor = substr($titlecolor, -6);

	$r1 = hexdec(substr($titlecolor, 0, 2));

	$g1 = hexdec(substr($titlecolor, 2, 2));

	$b1 = hexdec(substr($titlecolor, 4, 2));

	$tagcolor = substr($tagcolor, -6);

	$r2 = hexdec(substr($tagcolor, 0, 2));

	$g2 = hexdec(substr($tagcolor, 2, 2));

	$b2 = hexdec(substr($tagcolor, 4, 2));

	$titletext2 = stripslashes($titletext);

	$tagtext2 = stripslashes($tagtext);

	$image = imagecreatefrompng("banner/$select_banner");

	$titlecolor = imagecolorallocate($image, $r1, $g1, $b1);

	$tagcolor = imagecolorallocate($image, $r2, $g2, $b2);

	$shadow = imagecolorallocate($image, 153, 153, 153);

	if ($titleshadow == "yes"){

	ImageTTFText($image, $titlesize, 0, $titlex+1, $titley+1, $shadow, $titlefont, $titletext2);

	}

	if ($tagshadow == "yes"){

	ImageTTFText($image, $tagsize, 0, $tagx+1, $tagy+1, $shadow, $tagfont, $tagtext2);

	}

	ImageTTFText($image, $titlesize, 0, $titlex, $titley, $titlecolor, $titlefont, $titletext2);

	ImageTTFText($image, $tagsize, 0, $tagx, $tagy, $tagcolor, $tagfont, $tagtext2);

	$counterval = 0;

	$filename = "banners/counter.txt";

	$fp = fopen($filename, "r");

	$counterval = fread($fp, 26);

	fclose($fp);

	$counterval = (integer)$counterval + 1;

	$fp = fopen($filename, "w+");

	fwrite($fp, $counterval, 26);

	fclose($fp);

	$newbanner = 'banners/' . $counterval . '.png';

	ImagePNG($image, $newbanner);

	include("header.inc");

	echo "\n";
	
    echo "<img src=\"$newbanner\" width=\"468\" height=\"60\" alt=\"Your Generated Banner\" border=\"0\">\n";
    
    echo "<input name=\"bbcode\" value=\"[img]http://www.mysite.com/phpBB/weblogs/banner/{$newbanner}[/img]\" size=\"52\" /> <font color=\"#990000\">Use for signature</font>\n";
	
    echo "\n\n";

	include("footer.inc");

}  



?>
One the page,what I get is the created banner image and the url to the image so it can be pasted into ones sigline in a forum.
What Id like to do is be able to email that image through some sort of mail-to function possibly with a small form to write some text in.

If you would like to see the full effect,go ahead and use my testing generator and this maybe help see what I am trying to do.
It's almost like an ecard thing I want to do but cant seem to find any free code for that.
DEMO SITE

Posted: Wed May 25, 2005 5:53 pm
by hawleyjr
You can send an image as an attachment or as a linke in HTML. Check out PHPMailer:

http://phpmailer.sourceforge.net/