• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uploading/Resizing/Watermarking

#1
[eluser]Unknown[/eluser]
Hello there, I'm new to the forum and I've got a problem with image uploading with CI.
Now I would like to upload an image->watermark it->make a copy of it->resize the copy.

While I actually can upolad it and resize a copy, but I have trouble with watermark since it seems I can't do both. Here is the code:

Code:
$config['image_library'] = 'GD2';
$config['source_image'] = $value['full_path'];
$config['create_thumb'] = TRUE;
$config['thumb_marker'] = '_tn';
$config['master_dim'] = 'width';
$config['quality'] = 75;
$config['maintain_ratio'] = TRUE;
$config['width'] = 175;
$config['height'] = 175;
$config['new_image'] = './uploads/'.$newimagename;

$this->image_lib->initialize($config);
$this->image_lib->resize();
//Move Uploaded Files with NEW Random name
rename($value['full_path'],'./uploads/'.$newimagename);

If I leave this code I can do all the things I need without watermarking. So I add this:

Code:
$pic = realpath('./uploads/'.$newimagename);
        
$config2['image_library'] = 'GD2';
$config2['source_image'] = $pic;
$config2['wm_overlay_path'] = $png;
$config2['wm_opacity'] = '50';
$config2['wm_type'] = 'overlay';
$config2['wm_vrt_alignment'] = 'bottom';
$config2['wm_hor_alignment'] = 'center';
$config2['wm_x_transp'] = '20';
$config2['wm_padding'] = '-20';

//clear previous settings
$this->image_lib->clear();
//load new settings
$this->image_lib->initialize($config2);
$this->image_lib->watermark();

Now I get this result: I get two images, the first without watermarking, and the thumbnail watermaked, but still with original dimensions.

How can I fix this?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.