php graphics problem
php graphics problem
php graphics problem
php graphics problem
php graphics problem
php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem
php graphics problem php graphics problem
php graphics problem
Go Back  Xtreme Visual Basic Talk > > > php graphics problem


Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2014, 11:21 AM
starmanMike starmanMike is offline
Junior Contributor
 
Join Date: Oct 2005
Location: near Norwich, UK
Posts: 257
Default php graphics problem


I am a newcomer to php graphics, so I copied/pasted code which is supposed to work, but it doesn't! I just keep getting an error message which says "the image(http://localhost/alien/newpage.php) cannot be displayed, because it contains errors".
First off, that 'image' appears to be a file name, not an image!
Second, even when I have got the image, the rest of the page turns a dark grey instead of a nice, pristine white!
I know the header() has to be the first thing on the page, but the page also needs to get session variables - is this interfering in any way?
Basically, the large black square is intended to be a background on which filled circles (representing stars) will be plotted. Is this the best way to achieve this effect?
Sorry - that's 2 questions. I only really expect an answer to the first one!
Here's the page:
Code:
<?php
header ("Content-type: image/jpg");   
$im = imagecreate (800, 800);
$black = ImageColorAllocate ($im, 0, 0, 0); // background color
ImageFilledRectangle($im, 140, 240, 640, 740, $black);
imagejpg ($im);
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="" content="">
</head>
<body bgcolor="white">
<h1>Display page</h1>

</body>
</html>
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
php graphics problem
php graphics problem
php graphics problem php graphics problem
php graphics problem
php graphics problem
php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem php graphics problem
php graphics problem
php graphics problem
 
php graphics problem
php graphics problem
 
-->