Using Image Moo making thumbnails with watermarks and sizes
know there's a lot of resizing method out there but this image moo I love it... But the way it's processing the image is to damn slow. Friend of mine said that he tryed using this for bulk image it's just too slow... but if can install in our server it'll be easier but in here I don't want to install stuff because most of my clients are on shared hosting which I can install anything in it.
$this->load->library('upload'); $this->load->library('image_moo'); $config['upload_path'] = FCPATH.'uploads/images/sell/'; $config['allowed_types'] = 'gif|jpg|png'; $config['remove_spaces'] = TRUE; $this->upload->initialize($config); $fonts = FCPATH.'assets/home/font/arial.ttf'; if (!empty($post)) { $size_images = array('low','medium','large'); foreach ($size_images as $size_image) { if (!empty($_FILES['file_'.$size_image])){ if($this->upload->do_upload('file_'.$size_image)){ $results = $this->upload->data(); $uploaded_image = FCPATH.'uploads/images/sell/'.$results['file_name']; $sizes = array(120,230,500); $fontsize = 0; foreach ($sizes as $size) { if ($size == 120) $fontsize = 5; elseif ($size == 230) $fontsize = 9; elseif ($size == 500) $fontsize = 20; $thumb = str_replace('.', '_'.$size.'_'.$size.'.', $results['file_name']); $imageFile = FCPATH .'uploads/thumbs/sell/'.$thumb; $this->image_moo->load($uploaded_image)->make_watermark_text("fedrianto.com",$fonts,$fontsize,'#fff')->resize($size,$size,TRUE)->watermark(5)->save($imageFile,TRUE); } } } } }