Drawing Images in classes


Posted on 16th Feb 2014 07:03 pm by admin

I'm quite new to Object Oriented PHP. What I'm trying to do is draw some images but also have other content on the page.

Code: include('images.php');
//New Image set
Did you know?Explore Trending and Topic pages for more stories like this.
$im=new images();

//Sends headers and images don't work
echo "hello";

//New rect
$us=$ge->rect("Title");
$us->setDimensions(300,300);
$us->setBgColor('#606060');
$us->createImage();

There are 2 classes; images which extends rect. In the createImage() it draws an image on index.php?img=0 but only if no other headers are sent yet.
Code: function createImage(){
if ($_GET['img']==$this->id){
...
Code: imagepng($this->im);
ImageDestroy ($im);}
Is there anyway to draw this objects and also have content. I tried to see if I could draw the images through the images class like images.php?img=0 but that didn't work. I was also thinking if there was a way to send an if back to index from constructor and destructor. This is probably really confusing sorry, an help is appreciated
No comments posted yet

Your Answer:

Login to answer
241 Like 40 Dislike
Previous forums Next forums
Other forums

error with opendir
when i do this

if ($handle = opendir($dir)) {
while (false !== ($file = readdir($han

PHP Thumbnail Creation
Ok so i use this function to create thumbnails:

Code: [Select]function createthumb($name,$fil

RFQ Configuration - can you make PLANT field an optional field in ME42
Is there a way to make the plant field on an RFQ optional in change mode (ME42)?

Add "width" check when upload
Hi!

Can someone add a function that is checking if picture witdh is bigger then 800px whwn up

Problem with HTML form
Hello,

I made a HTML form with some fields and check box.
Everything works fine except whe

DATEDIFF Question
First time post, and of course it is a help question.

I am using a WP plug-in to display prev

Display a default image
I am trying to display generic image for items that don't have one, but I can't get it to display.

Are sessions secure at all?..
I haven't really gotten into yet, but I was just thinking of something weird..

Lets say you h

Sessions Value Not Saved
Hi,

Im making a login form and im using this code:
Code: if($login=="true"){

extending tidy
I have problem with type-hinting and extending tidy. This code creates error:
Code: class cMyTidy

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash