LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-05-2003, 04:39 PM   #1
Wonko the Sane
LQ Newbie
 
Registered: Nov 2002
Location: Raleigh, NC
Distribution: Gentoo
Posts: 20

Rep: Reputation: 0
Dabbling with php and GD


and so the fun begins, I'm not really used to working with images in PHP so i've been working on a script to update somethings for news titles with a nice font... but something isn't working


PHP Code:
<?php
        Header
("Content-type: image/jpeg");
        
$im imagecreate(399,43);
#       $im = imagecreatefromjpeg ('test.jpg');
        
$black imagecolorallocate($im0,0,0);
        
$grey imagecolorallocate($im66,66,66);
        
$white imagecolorallocate($im255,255,255);
        
$tan imagecolorallocate($im255,247,166);
        
imagettftext($im1806129$grey"./impact.ttf""Hello World");
        
imagettftext($im1806027$white"./impact.ttf""Hello World");
        
imagettftext($im14028629$grey"./impact.ttf""Feb. 05 2003");
        
imagettftext($im14028527$tan"./impact.ttf""Feb. 05 2003");
        
Imagejpeg($im,'',75);
        
ImageDestroy($im);
?>
would be my script I commented out the line which calls the image, what happens is that it outputs the image, but none of the ttf text shows up, just creating a new image works, so yeah, whats up with it

Thanks.

exampe of code that 'works' www.shinraonline.com/bob/test.old.php

Last edited by Wonko the Sane; 02-05-2003 at 04:46 PM.
 
Old 02-06-2003, 07:25 AM   #2
Wonko the Sane
LQ Newbie
 
Registered: Nov 2002
Location: Raleigh, NC
Distribution: Gentoo
Posts: 20

Original Poster
Rep: Reputation: 0
too little too late

i figured it out, i...bah just read the script...

PHP Code:
<?php
if (!isset($action)) {
$date = `date +'%b. %d %Y'`;
echo (
"<html>\n<head><title>News Updater</title></head>\n");
echo (
"<body>\n<font size=\"5\">News Updater</font>\n");
echo (
"<form action=\"?action=1\" method=\"post\">\n");
echo (
"Header<input type=\"text\" size=\"30\" maxlength=\"30\" name=\"header\"><br>\n");
echo (
"Date<input type=\"text\" size=\"12\" maxlength=\"12\" name=\"date\" value=\"$date\"><br>\n");
echo (
"<input type=\"submit\" value=\"Hag!\">\n");
echo (
"</form>\n</body>\n</html>");
}
if (
$action == 1) {
$header $HTTP_POST_VARS['header'];
$date $HTTP_POST_VARS['date'];
        
$im imagecreate(399,43);
        
$black imagecolorallocate($im0,0,0);
        
$white imagecolorallocate($im255,255,255);
        
$tan imagecolorallocate($im255,247,166);
        
$purple imagecolorallocate($im255,0,255);
        
imagefill ($im0,0,$purple);
        
imagecolortransparent($im$purple);
        
imagettftext($im1805129$black"./impact.ttf"$header);
        
imagettftext($im1805027$white"./impact.ttf"$header);
        
imagettftext($im14028629$black"./impact.ttf"$date);
        
imagettftext($im14028527$tan"./impact.ttf"$date);
        
$im2 imagecreatefromjpeg ("test.jpg");
        
imagecopymerge ($im2,$im0,0,0,0399,43,90); 
        
imagedestroy($im);
        
imagejpeg($im2,'news.jpg',100);
        
imagedestroy($im2);
echo (
"<html>\n<head><title>Yeah, Okay</title></head>\n<body>\n");
echo (
"<a href=\"news.jpg\">Here ya go</a>\n</body>\n</html>");
}
?>
good enough [=
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 09:37 PM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 12:05 PM
php apache or php cgi - php learner rblampain Linux - Security 3 12-18-2004 12:10 AM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 12:51 PM
Updating php 4.3.1 from tar and keeping current php configuration with mandrake 9.1 mrjeep Linux - General 0 04-02-2003 08:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration