• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload/thumbnail

#1
[eluser]felixk[/eluser]
Hey!

I've coded a image upload function and thumbnail creator. And it works well when I'm running it from my local server, but I've now moved it to another server, which causes the problem.

This is parts from my code!
Code:
// This part works!
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|jpeg|png';
        $this->load->library('upload', $config);

// Here comes the problem
        $root = "/Fredag/uploads/";
        //Array med alla uppladdningsinformation från "steg 1".
        $upload_data = $this->upload->data();
                
        // ------ STEG 2 ----- //
        $config['image_library'] = 'gd2';
        $config['source_image'] = $_SERVER['DOCUMENT_ROOT'].$root.$upload_data['orig_name'];
        $config['create_thumb'] = TRUE;
        $config['thumb_marker'] = ''; //ändelse innan filformatändelsen. (satt till noll)
        $config['new_image'] = $_SERVER['DOCUMENT_ROOT'].$root.'images/';

Quote:$_SERVER['DOCUMENT_ROOT'] = E:/www/fabrikenfredag.se/www
And the destination folder is E:www/fabrikenfredag.se/www/Fredag/uploads (/images/thumbs)

To sum up, the image is uploaded, but not resized. So it must be a problem to find the source image.

Thankful for help!

#2
[eluser]felixk[/eluser]
Anyone? :S

#3
[eluser]BrianDHall[/eluser]
Check out the PHP realpath function - your path to file declaration is a bit of a mess to figure out, so there is probably the error there. Try a simple hard-coded string for now to narrow it down.

Also check the is_file() function in PHP - use it on your file to explicitly let you know if the file path is wrong.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.