Welcome Guest, Not a member yet? Register   Sign In
stacking watermark and crop on a dynamic image
#1

[eluser]Unknown[/eluser]
i'm having a problem using the image manipulation library to create a dynamic logo. i have a text watermark and a crop function that won't run together. in a few forums it just says to re-initialize the library, which i did, and it didn't work. i attached the code. i also tweaked the image_lib a bit because it wasn't aligning the text watermark right properly(it was figuring my font incorrectly for distance, so instead of using the basic math, i used imagettfbbox to get the width and divided by the strlen to get the fontwidth properly) and so that i could create a value called $textwidth that would hold the width of the text. i would then add the textwidth together with the 210 pixels i used for the image on the right and i get my x_axis for cropping. but, the crop doesn't trigger unless i remove the watermark. i've turned on display_errors and got nothing. i have done unset($config) before i reconfigured the crop. nothing happened. I assume it's because it is calling imagejpeg() and essentially ending any more editing to that image... any help would be appreciated

Code:
$config['image_library'] = 'gd2';
  $config['source_image'] = 'img/logo.jpg';
  $config['wm_type'] = 'text';
  $config['quality'] = '100%';
  $config['wm_font_path'] = './css/philosopher.ttf';
  $config['dynamic_output'] = true;
  $config['wm_font_size'] = '33';
  $config['wm_font_color'] = '5C4F4E';
  $config['wm_hor_offset'] = '-210';
  $config['wm_vrt_offset'] = '42';
  $config['wm_vrt_alignment'] = 'T';
  $config['wm_hor_alignment'] = "right";
  $config['wm_text'] = str_replace('Breeders','',$this->site_name);
  $this->image_lib->initialize($config);
  $this->image_lib->text_watermark();


  $config['image_library'] = 'gd2';
  $config['source_image'] = 'img/logo.jpg';
  $config['dynamic_output'] = TRUE;
  $config['width'] = 210 + $this->image_lib->textwidth;
  $config['height'] = 105;
  $config['x_axis'] = 900 - $config['width'];
  $config['y_axis'] = 0;
  $config['maintain_ratio'] = false;
  $this->image_lib->initialize($config);
  $this->image_lib->crop();
#2

[eluser]hebe_210[/eluser]
Thx ,Im now on this kind of stuff .and I 've found a watermarking guide through google .share with you all.




Theme © iAndrew 2016 - Forum software by © MyBB