ctechguy Posted August 22, 2009 Share Posted August 22, 2009 I'm starting to learn Object Oriented and trying to make a simple object oriented program that creates an image and applies HTML hotspots on top. I think I need to have a separate page to display the image since it outputs the png header and another with HTML to reference the image. However I want to set all the method variables on one page. Is there a way to pass variables between php scripts. It would be great if someone could point me in the right direction. I'm quite confused. I have successfully create the image. index.php <?php include('class.php'); $us=new drawMe(300,300);?> class.php <?php class drawMe{ var $width; var $height; var $im; function __construct($w,$h){ $this->width=$w; $this->height=$h;} function output(){ header ("Content-type: image/png"); $this->im = imagecreate ($this->width, $this->height); ImageColorAllocate ($this->im, 0,0,0); imagepng($this->im); ImageDestroy ($im); } } ?> Link to comment https://forums.phpfreaks.com/topic/171366-solved-oop-interactive-image/ Share on other sites More sharing options...
ctechguy Posted August 24, 2009 Author Share Posted August 24, 2009 Figured it out, you use an if statement for outputting the image. <?php include('class.php'); $us=new drawMe(300,300); if ($_GET['img']==1){ $us->output(); die; } $us->map(); ?> map() function returns <img src=?img=1> and map info Link to comment https://forums.phpfreaks.com/topic/171366-solved-oop-interactive-image/#findComment-904950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.