LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 06-01-2007, 02:47 PM   #1
phpnewb72
LQ Newbie
 
Registered: Aug 2005
Location: Fresno, CA
Distribution: Ubuntu, FC8 x64, Centos
Posts: 29

Rep: Reputation: 15
PHP GD and system()


Is there a way to intergrate something like system("uname -r"); into an gd created image?

I was hoping something like this would work:

$im=imagecreate(300,400);
$white=imagecolorallocate($im,255,255,255);
$black=imagecolorallocate($im,0,0,0);

imagestring($im,6,5,10,system("uname -r"),$white);
 
Old 06-02-2007, 02:27 AM   #2
Guttorm
Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 959

Rep: Reputation: 157Reputation: 157
Hi

The only problem I can think of is that system outputs the results of the command - and it returns the last line of the output, so your code should work, but you can't output the image after you have started outputting text.

So better change the "system" into "exec" or "popen" so you can get the result in a string first without any output.
 
Old 06-05-2007, 04:20 PM   #3
phpnewb72
LQ Newbie
 
Registered: Aug 2005
Location: Fresno, CA
Distribution: Ubuntu, FC8 x64, Centos
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Guttorm
Hi

The only problem I can think of is that system outputs the results of the command - and it returns the last line of the output, so your code should work, but you can't output the image after you have started outputting text.

So better change the "system" into "exec" or "popen" so you can get the result in a string first without any output.
nice, thanks. exec() works much better.

cheers!
 
  


Reply

Tags
gd, php, system


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System command from PHP Richtown Linux - Newbie 1 05-16-2007 10:15 AM
php squirrelmail system() mhatre kedar Programming 0 04-15-2005 02:33 AM
System properties in PHP? Napalm Llama Programming 4 02-15-2005 04:42 AM
php and system mail funkyche Linux - Software 6 12-13-2004 11:43 AM
php and system() Marble Linux - Security 5 07-09-2003 08:27 PM


All times are GMT -5. The time now is 06:43 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration