Re: Upload bright color image become darken

See all posts Reply

Re: Upload bright color image become darken new!
by Ting, 8 years, 1 month ago
Original file
http://tinypic.com/r/300b320/9

After upload
http://tinypic.com/r/zk65h3/9

Script

// save uploaded image with no changes
$img_class->file_new_name_body = $image_name;

$img_class->image_resize = false;
$img_class->image_ratio_crop = false;

// save to root $path
if ($key_w == '358' && $value_h == '358'){// to 500x492 folder
$img_class->image_resize = true;
$img_class->image_x = $key_w;
$img_class->image_y = $value_h;
// fit image to specific size
$img_class->image_ratio_crop = true;
// no image part, set background color
//$img_class->image_background_color = '#fff';
}elseif($key_dir == 'b'){ // to b folder
$img_folder = $key_dir.'/';
}else{// save to *x* folder
$img_class->image_resize = true;
$img_class->image_x = $key_w;
$img_class->image_y = $value_h;
// crop image
$img_class->image_ratio_crop = true;
$img_folder = $key_dir.'/';
}

//$img_class->image_ratio_fill = true;
//$img_class->image_background_color = '#fff';

$img_class->file_overwrite = true;
$img_class->dir_auto_create = true;
$img_class->Process($_SERVER['DOCUMENT_ROOT'].'/Uploads/'.$path.'/'.$img_folder);
if ($img_class->processed) {/*echo 'original image copied'; echo $img_class->file_dst_name;*/} else {echo 'error : ' . $img_class->error;}Reply
Re: Upload bright color image become darken new!
by colin, 8 years, 1 month ago
Sell, since there is a resizing, there a JPEG compression, and you loose in quality, it is normal. What you can do is change the jpeg_quality setting to have a better quality.Reply
Re: Upload bright color image become darken new!
by Ting, 8 years, 1 month ago
Hi,
I have try following still the same.
$img_class->image_resize = false;
$img_class->image_ratio_crop = false;
$img_class->png_compression = 0;
$img_class->jpeg_quality = 100;

//$img_class->log
======================
- class version : 0.33
- operating system : Linux
- PHP version : 5.3.29
- GD version : 2.1.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 1500M (1572864000 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- 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
PHP exec() function is disabled
- 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 : PHJ_GS_102972.png
file_src_name_body : PHJ_GS_102972
file_src_name_ext : png
file_src_pathname : /tmp/php1SmAPB
file_src_mime : image/png
file_src_size : 1467572 (max= 1572864000)
file_src_error : 0
- source file is an image
image_src_x : 1000
image_src_y : 667
image_src_pixels : 667000
image_src_type : png
image_src_bits : 16
process file to /home/dewingssports/public_html/welcome2/Uploads/Product/b/
- file size OK
- file mime OK : image/png
- new file name body : Product-1476342636-4950-PHJ_GS_102972
- file name safe format
- destination variables
file_dst_path : /home/dewingssports/public_html/welcome2/Uploads/Product/b/
file_dst_name_body : Product-1476342636-4950-PHJ_GS_102972
file_dst_name_ext : png
- no auto_rename if same filename exists
- destination file details
file_dst_name : Product-1476342636-4950-PHJ_GS_102972.png
file_dst_pathname : /home/dewingssports/public_html/welcome2/Uploads/Product/b/Product-1476342636-4950-PHJ_GS_102972.png
- no overwrite checking
- image resizing or conversion wanted
- source image is PNG
- setting destination file type to png
- auto-rotate requires function exif_read_data to be enabled
- converting...
- saving image...
PNG image created
image objects destroyed
- process OKReply
Re: Upload bright color image become darken new!
by colin, 8 years, 1 month ago
As I said, you are loosing quality because it resizes and recompresses the image. I am not sure we can do anything about it.Reply