Local File Disappearing

See all posts Reply

Local File Disappearing new!
by Fred, 12 years, 1 month ago
The following code returns "image resized" message but doesn't work. I have a file already on the server and this code somehow deletes it but doesn't replace it:
$handle=new upload(getcwd().$this->output_folder.$this->file_name.".".$file_info["extension"]);
if ($handle->uploaded) {
  $handle->image_resize         = $this->resize;
  $handle->image_x              = $this->max_width;
  $handle->image_y              = $this->max_height;
  $handle->file_overwrite = $this->overwrite;
  $handle->process(getcwd().$this->output_folder);
  if ($handle->processed) {
    echo 'image resized';
    $handle->clean();
  } else {
    echo 'error : ' . $handle->error;
  }
}

I am trying to resize and then overwrite the existing image.Reply
Re: Local File Disappearing new!
by colin, 12 years, 1 month ago
Copy here the log produced by the class. Also check the permissions on the output folderReply
Re: Local File Disappearing new!
by Fred, 12 years, 1 month ago
What do you mean by log? All it outputs is the message thats its been resized.Reply
Re: Local File Disappearing new!
by colin, 12 years, 1 month ago
PLease check out the FAQReply
Re: Local File Disappearing new!
by Fred, 12 years, 1 month ago
Ok I have found the error. It seems when I call the clean() function it treats the existing file as a "temp" one and and promptly deletes it. " delete temp file /uploads/avatars/avatar1.png"

By not calling clean() it works. This is the log:

system information
- class version : 0.31
- operating system : WINNT
- PHP version : 5.3.4
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 100M (104857600 bytes)
- language : en_GB
source is a local file /uploads/avatars/avatar1.png
- local file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
    Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
    UNIX file() command not availabled
- Checking MIME type with mime.magic file (mime_content_type())
    mime_content_type() is not available
- Checking MIME type with getimagesize()
    MIME type detected as image/png by PHP getimagesize() function
- MIME validated as image/png
source variables
- You can use all these before calling process()
    file_src_name : avatar1.png
    file_src_name_body : avatar1
    file_src_name_ext : png
    file_src_pathname : C:\wamp\www\mow_calc/themes/_default/uploads/avatars/avatar1.png
    file_src_mime : image/png
    file_src_size : 61257 (max= 104857600)
    file_src_error : 0
- source file is an image
    image_src_x : 300
    image_src_y : 228
    image_src_pixels : 68400
    image_src_type : png
    image_src_bits : 8
process file to uploads/avatars/\
- file size OK
- file mime OK : image/png
- new file name body : avatar1
- file name safe format
- destination variables
    file_dst_path : uploads/avatars/\
    file_dst_name_body : avatar1
    file_dst_name_ext : png
- no auto_rename if same filename exists
- destination file details
    file_dst_name : avatar1.png
    file_dst_pathname : /uploads/avatars/\avatar1.png
- no overwrite checking
- image resizing or conversion wanted
- source image is PNG
- setting destination file type to png
- resizing...
    use plain sizes
    resized image object created
    image_src_x y : 300 x 228
    image_dst_x y : 100 x 100
- converting...
- saving image...
    PNG image created
    image objects destroyed
- process OK
cleanup
- delete temp file /uploads/avatars/avatar1.pngReply