Reply to how to omit file_dst_name_ext

how to omit file_dst_name_ext new!
by Eli, 14 years ago
Hi,

great script, but there is one thing I have not been able to solve and its driving me crazy.

this is my script:
if ($handle->uploaded) {
  $handle->file_dst_name           = str_replace('.' . $handle->file_dst_name_ext, '', $_FILES['Filedata']['name']);
  $handle->file_new_name_body      = $handle->file_dst_name;
  $handle->file_safe_name          = false;

  $handle->Process($dir_dest);

  // we now process the image a second time, with some other settings
  $handle->image_resize            = true; // we resize the image
  $handle->image_ratio_x           = true; // we want to keep the ratio of the width
  $handle->image_y                 = 100; // we set the height to 150px, keeping the width automatic
  $handle->file_dst_name           = str_replace('.' . $handle->file_dst_name_ext, '', $_FILES['Filedata']['name']);
  $handle->file_new_name_body      = $handle->file_dst_name;
  $handle->file_safe_name          = false;
  $handle->file_name_body_pre      = 'thumb_'; // this adds -thumb at the end of the file to let you know its a thumbnail

  $handle->Process($dir_dest.'/thumbs/');

  // we delete the temporary files
  $handle-> Clean();
}

ok, so my problem is that on the first pass the file is uploaded looks like this picturejpg.jpg but on the second pass when I make my thumbnail it does it correct and outputs like this: thumb_picture.jpg

I can't figure out why on the first pass it won't remove the .jpg from the file.

without any processing and leave it at its defaults the files are uploaded like this

picturejpg.jpg
thumb_picturejpg.jpg

so I tried to do a string replace to remove the .jpg, it works for the second pass but now the first...


any ideas?Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important