PHP Classes

Problem in resizing uploded images

Recommend this page to a friend!

      Easy Resize Image  >  All threads  >  Problem in resizing uploded images  >  (Un) Subscribe thread alerts  
Subject:Problem in resizing uploded images
Summary:problem using move_uploaded_file()
Messages:5
Author:Javad Ahmadzadeh
Date:2009-04-27 06:43:16
Update:2009-04-29 02:39:45
 

  1. Problem in resizing uploded images   Reply   Report abuse  
Picture of Javad Ahmadzadeh Javad Ahmadzadeh - 2009-04-27 06:43:16
imagine that i've uploaded a file and i want to resize it on-fly, i'm using a command like this ...

have it in mind that there is no problem with a fixed image (which is truly exist on drive)

(file inclusion and stance-making is ignored / method names are changed a bit !)

$r_image = $imageResize->resize($_FILES['adv_img']['tmp_name'], 468);

would you mind please find and solve the problem ...

  2. Re: Problem in resizing uploded images   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2009-04-27 19:26:36 - In reply to message 1 from Javad Ahmadzadeh
Try to read $_FILES content into a variable:

$string = fread ( fopen ( $_FILES [ 'adv_img' ] [ 'tmp_name' ], "rb" ), filesize ( $_FILES [ 'adv_img' ] [ 'tmp_name' ] ) );

And call the constructor...:

$r_image = $imageResize -> resize ( $string, 468 );

  3. Re: Problem in resizing uploded images   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2009-04-27 19:36:43 - In reply to message 2 from László Zsidi
Ops...my reply was unfortunately above:)

You can't read the $_FILES content on-the-fly.
Must be used the move_uploaded_file() function to store somewhere the uploaded data into a temporary file on your server, and you give the path of stored file in the class constructor.
If you are finished, then you can delete simple your temporary file(s) by unlink() function.

  4. Re: Problem in resizing uploded images   Reply   Report abuse  
Picture of Javad Ahmadzadeh Javad Ahmadzadeh - 2009-04-28 19:54:56 - In reply to message 1 from Javad Ahmadzadeh
Thanks anyway ...

  5. Re: Problem in resizing uploded images   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2009-04-29 02:39:45 - In reply to message 4 from Javad Ahmadzadeh
You're welcome my friend:)