PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Aug 11, 2020 11:13 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Sep 22, 2004 6:37 pm 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38
Alright, I've got the image part working (YAY!).

http://www.minime001.net/test2.php

Syntax: [ Download ] [ Hide ]
<?php

  $img = imagecreatefrompng("test.PNG");

  $white = imagecolorallocate($img, 255,255,255);

  $text = "testing2";

  imagefttext($img, 8, 0, 2, 25, $white, 'fonts/tahoma.ttf', $text, array());

  header('Content-type: image/png');

  imagepng($img);

  imagedestroy($img);

?>


But what I need now is how I could make up a simple (secure) form that would write news to both my index page and this file. I realize how I could initialize the variables and everything, but what I need to know is where they would be submitted to and how they would be read. Could I write them to an xml file? that sounds like the easiest thing to do (if that's possible).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 7:11 pm 
Offline
Forum Commoner

Joined: Thu Sep 09, 2004 11:10 pm
Posts: 62
Location: Breckenridge, Colorado


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 7:32 pm 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 7:33 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 23, 2003 3:10 am
Posts: 11470
Location: Toronto


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 10:05 am 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38
Ok, yeah, but then how would I do that?

Btw, I got the news to show up on both via a text file:
Image
http://www.minime001.net/news.txt
Syntax: [ Download ] [ Hide ]
<?PHP

$img = imagecreatefrompng("news.PNG");

$newstext = file('news.txt');

$white = imagecolorallocate($img, 255,255,255);

$howfar = 25;



foreach ($newstext as  $line)

{

  $line = trim($line);

  if (substr($line, 0, 4) == "<h3>" )

  {

    // Found Date

    $line = strip_tags($line);

    $currentdate = $line;

  }

  else

  {

    $line = strip_tags($line);

    if (strlen($line) > 3)

    {

      //Found Info

      imagefttext($img, 8, 0, 2, $howfar, $white, 'fonts/tahoma.ttf', $currentdate . ' ' . $line, array());

      $howfar += 15;

    }

  }

}

header('Content-type: image/png');

imagepng($img);

imagedestroy($img);

?>

But it's blurry. And runs off the screen. I don't see that I could do anything about it running off the screen except by shortening the news, but could I somehow convert to a numerical date instead of the month spelled out for that (MM/DD/YY)? If not, I guess I'd have to use separate txt files for both my page and the pic. And in that case, I definitly want a submit thing that would write to both of them. So how would I do all this?
Oh, and the blurry part. Can I make it just write a font like normal text (no blur, only white pixels) or something?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 12:35 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
you're the one controlling the date information. you can change the format. Here's a hint, use a database.


Last edited by feyd on Fri Sep 24, 2004 12:46 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 12:41 pm 
Offline
Forum Regular
User avatar

Joined: Wed Jul 30, 2003 3:29 am
Posts: 875
Location: Sweden


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 1:04 pm 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 1:22 pm 
Offline
Neighborhood Spidermoddy
User avatar

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 1:45 pm 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38
I don't expect you to give me a long post of code or anything. I just don't understand a lot of this, and therefore need help with it so I can figure out what to do. ;)

aliasing, yeah. that's what I meant. But you think it looks ok that way? okay, I guess.

when you say I can store the information in fields, .. well... so what's a field? ^^;

"form processor...." yeah, I knew I had to do something like that, I just don't know how to do any of it. How would I validate it? (And when you say validate, you do mean to make sure I'm the only one submitting, etc, right?) How would I have a script create an image that isn't recreated when it's viewed? You mean like I could make a completely separate png that, after created, would function completely separate from the script?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 2:13 pm 
Offline
Neighborhood Spidermoddy
User avatar

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 2:49 pm 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38
alright. I'm starting to see how this'll all come together.

But before I can do anything, I need to get started. I can create a database and a user for it via my control panel for my site (which I usually don't like using). But what do I do after that? I can now (sorta) see how to submit a password to a database, but how would I read it? what would go inside the database? um... what exactly is a database? ^^; I've tried to google a tut about databases, but haven't found anything so far. You know of one I could read?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 3:31 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 23, 2003 3:10 am
Posts: 11470
Location: Toronto
to access your database you can use phpmyadmin


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 4:32 pm 
Offline
Forum Commoner

Joined: Sun Sep 12, 2004 4:07 pm
Posts: 38
aha, found a place where it says fields. For that, I put in 2, right? So what do I do then (where's a newb faq!? T_T )?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 6:13 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf may help you out a bit.
there have been many many many threads regarding how to set up tables and database design..


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 9 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