Reply to Re: Problem with Extension ... .txt instead of .jpg

Re: Problem with Extension ... .txt instead of .jpg new!
by DJo, 15 years, 10 months ago
And my log with a PNG File:

system information
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : en_GB
source is a local file /tmp/phpopCwHr
- local file name OK
- MIME type detected as image/png by UNIX file() command
- source variables
file_src_name : phpopCwHr
file_src_name_body : phpopCwHr
file_src_name_ext :
file_src_pathname : /tmp/phpopCwHr
file_src_mime : image/png
file_src_size : 102997 (max= 8388608)
file_src_error : 0
- source file is an image
image_src_x : 450
image_src_y : 300
image_src_pixels : 135000
image_src_type : png
image_src_bits : 8
process file to /var/www/*************/web/images/produits/galerie/
- file size OK
- script phpopCwHr renamed as phpopCwHr.txt!
- file mime OK : text/plain
- new file name body : img_2-5
- file name safe format
- destination variables
file_dst_path : /var/www/*************/web/images/produits/galerie/
file_dst_name_body : img_2_5
file_dst_name_ext : txt
- image operation, keep extension
- no auto_rename if same filename exists
- destination file details
file_dst_name : img_2_5.txt
file_dst_pathname : /var/www/*************/web/images/produits/galerie/img_2_5.txt
- no overwrite checking
- image resizing or conversion wanted
- source image is PNG
- setting destination file type to txt
- resizing...
calculate y size
resized image object created
image_src_x y : 450 x 300
image_dst_x y : 1 x 1
- converting...
fills in transparency with default color
- saving image...
JPEG image created
image objects destroyed
- process OK


That's really strange.
Do you have an idea ? Is it because I'm using Symfony before ?

This is my PHP Code:
$handle = new upload($file->getTempName());
        
if ($handle->uploaded) {

  // Version mini
  $handle->jpeg_quality = 90;
  $handle->file_new_name_body = "img_".$img->getProduitsId()."-".$img->getId();
  $handle->mime_check = false;
  $handle->auto_create_dir = true;
  $handle->dir_auto_chmod = true;
  $handle->dir_chmod = 0777;
  $handle->image_resize         = true;
  // $handle->image_convert = 'jpg';
  $handle->image_x  = sfConfig::get('app_images_widthprodimages');
  $handle->image_ratio_y  = true;
  $handle->preserve_transparency = true;
  $handle->file_auto_rename = false;
  $handle->file_overwrite = true;
  $handle->Process($path);
  echo $handle->log;

  if ($handle->processed) {
    $handle->clean();
    $finalImage = $handle->file_dst_name;
  } else {
    echo $handle->error;
    $handle->clean();
  }
}

Thanks for your help and for your class !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