Thread: Gallery problem
View Single Post
Old 11-11-2008, 03:33 PM   #1 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default Gallery problem

Hi!

I've hit a problem:

php Code:
public function uploadImage($szInputName)
    {
       
        $this->form_inputName = $szInputName;
       
        // If the neccessary stuff has been set
        if(isset(parent::$path) && isset($this->user))
        {
            //I'm doing some stuff here..
           
        }
       
        else throw new Exception('Everything is not set yet.');
       
    }

php Code:
include('Gallery.php');
    include('Upload.php');
   
    $allowed = array(
   
        'jpeg',
        'gif',
        'png'
   
    );
   
    try
    {
       
        $gallery = new Gallery(NULL, 'images/');
        $gallery->setAllowedTypes($allowed);
        $gallery->setLimitFileType('no');
        $gallery->setThumbSize(400, 600);
        $gallery->setMaxFileSize(100000);
       
        $upload = new Upload(2);
        $upload->uploadImage('filename');
       
    }
   
    catch(Exception $error)
    {
       
        echo $error->getMessage();
       
    }

Gives me:
Code:
Everything is not set yet.
Which means that either path is not set, or the user id is not set.

And you can see that I've set both userid:
PHP Code:
$upload = new Upload(2); 
and the path:
PHP Code:
$gallery = new Gallery(NULL'images/'); 
So I'm thinking that perhaps this is wrong:
PHP Code:
parent::$path 
Is that an incorrect way of doing it?
Haven't worked much with parents and stuff..

The path variable in the gallery class(which the upload class extends) is set to protected.

Any ideas why this error is thrown?
__________________
Tanax is offline  
Reply With Quote