PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Jul 02, 2020 10:57 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Jul 02, 2004 2:40 am 
Offline
Forum Commoner

Joined: Tue Mar 16, 2004 5:54 pm
Posts: 27
I have a site where I want people to be able to make personal banners for there homepage

I want it to have 2 variables for the text

$text-name
and $text-desc

so it has the pre-selected banner and it adds text-name in big letters with customizable colors/fonts and the desc smaller

is there a way to do this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 02, 2004 2:44 am 
Offline
Forum Commoner

Joined: Tue Mar 16, 2004 5:54 pm
Posts: 27
also i want it to save as $sess_user."_banner.jpeg"

and if that file already exists then I want it to delete it

does anyone know how to do all this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 02, 2004 2:46 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
read the [php_man]image[/php_man] function documentation.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 02, 2004 3:23 am 
Offline
Forum Commoner

Joined: Tue Mar 16, 2004 5:54 pm
Posts: 27
Syntax: [ Download ] [ Hide ]
<HTML><HEAD>

<TITLE>EZ Banner -- Online Banner Creator</TITLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

   <meta name="keywords" PHP, Cynthia Porter, Banner Generator">

   <meta name="description" content="PHP Program to generate banners on-line.">

   <meta name="author" content="Cynthia Porter">

</HEAD>



<BODY bgColor=#ffffff vLink=#0000ff>

<DIV align=center>

<h1>EZ Banner Creator</h1>

<TABLE border=1>

   <TR>

   <TD bgColor=#99cc99>

   <FORM action=draw3.php>

   <P align=center>

      <TABLE border=1>

        <TR>

          <TD align=left><b>Banner Color</b></td>

          <TD align=middle><B>Line 1 Text Color</B></TD>

          <TD align=right><B>Line 2 Text Color</B></TD>

        </TR>

        <TR>

          <TD align=left>

          <B>R</B><INPUT name=r_b size=3 value=255 maxsize="3">

          <B>G</B><INPUT name=g_b size=3 value=000 maxsize="3">

          <B>B</B><INPUT name=b_b size=3 value=000 maxsize="3">

          </TD>

          <TD align=middle>

          <B>R</B><INPUT name=r_t1 size=3 value=000 maxsize="3">

          <B>G</B><INPUT name=g_t1 size=3 value=000 maxsize="3">

          <B>B</B><INPUT name=b_t1 size=3 value=000 maxsize="3">

          </TD>

          <TD align=right>

          <B>R</B><INPUT name=r_t2 size=3 value=255 maxsize="3">

          <B>G</B><INPUT name=g_t2 size=3 value=255 maxsize="3">

          <B>B</B><INPUT name=b_t2 size=3 value=255 maxsize="3">

          </TD>

        </TR>

        <TR>

          <TD align=middle colSpan=3><B>Text Line 1:</B><INPUT value="hoodz crew" name=string1 size=43

            maxsize="80">  

          </td>

         </tr>

        <tr>

          <TD align=middle colSpan=3><B>Text Line 2:</B><INPUT value="illest in the game!" name=string2 size=43

            maxsize="80">  

          </td>

        </tr>

        <TR>

          <TD align=middle>

          <INPUT type=submit value="Create Banner">

          <INPUT type=reset value=Reset>

          </td></tr>

         

          </TABLE>

      <p><b>Instructions:</B><br>

      <P>Choose your Background, Text Line 1, and Text Line 2 colors.

         Enter Text Line 1 and Text Line 2 as this will be the text that

         will be on your banner.  <br>

         Click the "Create Banner" button and your banner will appear at the

         bottom of this page along with its URL.  

         <br><br>



      <TABLE>

     

        <TR>

          <TD>

            <P><FONT size=-1>**Color is determined by the RedGreenBlue value.

            To see the values of colors, go <A

            href="http://www.websitetips.com/designer/colors2.html">here</A>

            to find your own colors then click your browser's back

            button to return to this page.

            </FONT></P></TD></TR></TABLE>

   </FORM>

   

<br>



</td></tr></table>

</DIV>



<center>

<br><br><br>



<? if ((isset($string1) || $string1 > "")

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



     chmod("banners", 0777);



$id = imagecreatefromjpeg("banners/1.jpg");



//$id = ImageCreate(460, 40);

//ImageFilledRectangle ($id, 0, 0, 460, 40, $bgc);





     $bgc = ImageColorAllocate($id, $r_b, $g_b, $b_b);

     $color1 = ImageColorAllocate($id, $r_t1, $g_t1, $b_t1);

     $color2 = ImageColorAllocate($id, $r_t2, $g_t2, $b_t2);

     ImageString($id, 5, 10, 2, $string1, $color1);

     ImageString($id, 5, 10, 20, $string2, $color2);

     $counterval = 0;

     $filename = "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 . '.jpg';

     ImagePNG($id,$newbanner);

     $string1 = '';

     $string2 = '';

     echo '<img src=' . $newbanner . '><br>';

     echo '<a href=http://ezbanner.sourceforge.net/' . $newbanner . '>http://ezbanner.sourceforge.net/' . $newbanner . '</a>';

}



?>



</center>

<center>

<br><br>



</center>

</BODY></HTML>



^I got that code from a website.

How do I make it so the person can edit which font is being used? and so the colors on the form are RED GREEN BLUE instead of the hex codes.


feyd | Please use
Syntax: [ Download ] [ Hide ]
tags when posting code. Read:  </span>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 02, 2004 3:32 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
Well.. it looks like the RGB values are already 0-255 fields... Next thing, that script was written with register_globals on.. for fonts, you'll have to enumerate the fonts you have available for them to use.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 03, 2004 12:20 am 
Offline
Forum Commoner

Joined: Tue Mar 16, 2004 5:54 pm
Posts: 27


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 03, 2004 12:25 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 03, 2004 12:30 am 
Offline
PHP Evangelist
User avatar

Joined: Tue Aug 13, 2002 3:35 pm
Posts: 3547
Location: Calgary, Canada


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group