Can I call a class inside a function?


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

I have a class written in another file that handles my image resizing.

Can I do this (php says I can't calling a non-existent class), but I know its there becuase the require doesn't fail above

Code: [Select]<?php
<?php
require_once("image_load.php");
...
....

function image_upload($tmp_name,$imgid){

$image = new easyImageEdit();
$image->load(UPLOADS.$tmp_name);
$image->resizeToWidth(250);
}
?>

No comments posted yet

Your Answer:

Login to answer
146 Like 19 Dislike
Previous forums Next forums
Other forums

Facebook status update API
Hello,

So, I'm trying to create my first Facebook application with PHP.

Basic ideas fo

Unidentified index error in a simple form
I have been trying to make an HTML form that is handled by a PHP script. So far my attempts to get i

How to extract/download content from HTTPS page?
Hello to all the Members of this forum, Im Shoiab, A novice programmer in php.. for my first job I h

background color imagefill
Hello

I would like to ask you why I see this square in red color just in my local xampp insta

Getting Resource id #11 while trying to connect..
So i tried using "DEFINE" for the first time and im using the variables i defined to conne

Table colours fail when extra row added
Hey Gurus,

I got a weird problem with formating the colour of a table made in php. Everything

Is there a more efficient way to code this than what I have?
I have three associative arrays.

$combinedSettings
$userSettings
$defaultSettings

Error querying database.
I get the above error when trying to insert some values to a datatable.
Here's the code :

please fix the error
What is the error in the below code ???
Line number On/Off | Expand/Contract <?php

MVC - Code review
I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to impl

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