image - losing quality after adding watermark to the picture -
i'm working on website wich haven't create/developed
anyway users can upload image , when , there's function create duplicate of image watermark
but copy watermark has low quality , it's size smaller original image
i dont see lowering quality , maybe it's how ci watermark works ?!
without watermark
http://img.akstube.ir/images/2013/05/dsc_0168_69_70_tonemapped.jpg
with watermark
http://img.akstube.ir/images/2013/05/irwm_dsc_0168_69_70_tonemapped.jpg
here function
function ir_watermark($file,$name='',$rebuild=false) { $ci = &get_instance(); $pathinfo = pathinfo($file); $filename = $pathinfo['basename']; $path = $pathinfo['dirname']; $new_image = $path . '/irwm_'. $filename; $path_to_img = base_url(str_replace(base_path(),'',$new_image)); if ($rebuild == false) if (file_exists($new_image)) { if ($ci->uri->segment(1) == 'test') echo "<img src='{$path_to_img}' />"; return $path_to_img; } $config['source_image'] = $file; $config['new_image'] = $new_image; $config['wm_type'] = 'overlay'; $config['wm_overlay_path'] = base_path('/files/transparent_bar.png'); $config['wm_font_path'] = base_path('application/assets/view/tahomabd.ttf'); $config['wm_font_size'] = '8'; $config['wm_font_color'] = 'ffffff'; $config['wm_vrt_alignment'] = 'bottom'; $config['wm_hor_alignment'] = 'left'; $config['wm_hor_offset'] = '0'; $config['wm_vrt_offset'] = '0'; $ci->image_lib->initialize($config); $ci->image_lib->watermark(); $config['new_image'] = $config['new_image']; $config['source_image'] = $config['new_image']; $config['wm_hor_offset'] = '10'; $config['wm_vrt_offset'] = '2'; $config['wm_overlay_path'] = base_path('/files/akstube_logo6.png'); $ci->image_lib->initialize($config); $ci->image_lib->watermark(); $config['wm_type'] = 'text'; $config['wm_vrt_offset'] = '-3'; $config['wm_text'] = 'photo : ' . $name; $config['wm_text'] = strtoupper($config['wm_text']); $config['wm_hor_alignment'] = 'right'; $config['wm_hor_offset'] = '-50%'; $ci->image_lib->initialize($config); $ci->image_lib->watermark(); if ($ci->uri->segment(1) == 'test') echo "<img src='{$path_to_img}' />"; return $path_to_img; }
watermark image
http://akstube.ir/files/akstube_logo6.png http://akstube.ir//files/transparent_bar.png
Comments
Post a Comment