al3x8730 Posted September 14, 2008 Share Posted September 14, 2008 How would I create a dynamic image that would get $Num and put that in the image along with something that would be constant like "there are ".$Num. " users in the database"; in the image? <?php $Num = mysql_query("SELECT * FROM `users`"); $Num = mysql_num_rows($Num); echo "<center>There are <b><u>" . $Num . "</b></u> Users in the database.<br /></center>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/124227-php-dynamic-images/ Share on other sites More sharing options...
Adam Posted September 14, 2008 Share Posted September 14, 2008 http://us.php.net/manual/en/function.imagestring.php Adam Quote Link to comment https://forums.phpfreaks.com/topic/124227-php-dynamic-images/#findComment-641499 Share on other sites More sharing options...
al3x8730 Posted September 14, 2008 Author Share Posted September 14, 2008 http://us.php.net/manual/en/function.imagestring.php Adam I tired: <?php include('header.php'); $Num = mysql_query("SELECT * FROM `users`"); $Num = mysql_num_rows($Num); // Create a 200*30 image $im = imagecreate(100, 30); // White background and blue text $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 255); // Write the string at the top left imagestring($im, 5, 0, 0, 'There are '.$Num.' Users in the EOdata User Database', $textcolor); // Output the image header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> And it didn't work. Also where would I go to view this image? Quote Link to comment https://forums.phpfreaks.com/topic/124227-php-dynamic-images/#findComment-641504 Share on other sites More sharing options...
Adam Posted September 14, 2008 Share Posted September 14, 2008 what happens in header.php? Basically you're setting the PHP file to display as an image, so you'd just use something like: <img src="your-php-file.php" /> You can't print out any HTML in the page though otherwise it won't work! Adam Quote Link to comment https://forums.phpfreaks.com/topic/124227-php-dynamic-images/#findComment-641517 Share on other sites More sharing options...
al3x8730 Posted September 14, 2008 Author Share Posted September 14, 2008 what happens in header.php? Basically you're setting the PHP file to display as an image, so you'd just use something like: <img src="your-php-file.php" /> You can't print out any HTML in the page though otherwise it won't work! Adam header.php is connect information for MySql. Help plz x.x Quote Link to comment https://forums.phpfreaks.com/topic/124227-php-dynamic-images/#findComment-641540 Share on other sites More sharing options...
al3x8730 Posted September 14, 2008 Author Share Posted September 14, 2008 acidentally double post x.x Quote Link to comment https://forums.phpfreaks.com/topic/124227-php-dynamic-images/#findComment-641542 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.