A_Watermarking_Ajax_Actions

Class A_Watermarking_Ajax_Actions.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php  
  1. class A_Watermarking_Ajax_Actions extends Mixin 
  2. /** 
  3. * Gets the new watermark preview url based on the new settings 
  4. * @return array 
  5. */ 
  6. function get_watermark_preview_url_action() 
  7. $security = $this->get_registry()->get_utility('I_Security_Manager'); 
  8. $sec_actor = $security->get_current_actor(); 
  9. if ($sec_actor->is_allowed('nextgen_edit_settings')) { 
  10. $settings = C_NextGen_Settings::get_instance(); 
  11. $imagegen = C_Dynamic_Thumbnails_Manager::get_instance(); 
  12. $mapper = C_Image_Mapper::get_instance(); 
  13. $image = $mapper->find_first(); 
  14. $storage = C_Gallery_Storage::get_instance(); 
  15. $sizeinfo = array('quality' => 100, 'height' => 250, 'crop' => FALSE, 'watermark' => TRUE); 
  16. $size = $imagegen->get_size_name($sizeinfo); 
  17. $thumbnail_url = $storage->get_image_url($image, $size); 
  18. // Temporarily update the watermark options. Generate a new image based 
  19. // on these settings 
  20. if ($watermark_options = $this->param('watermark_options')) { 
  21. $watermark_options['wmFont'] = trim($watermark_options['wmFont']); 
  22. $settings->set($watermark_options); 
  23. $storage->generate_image_size($image, $size); 
  24. $thumbnail_url = $storage->get_image_url($image, $size); 
  25. $settings->load(); 
  26. return array('thumbnail_url' => $thumbnail_url); 
  27. } else { 
  28. return array('thumbnail_url' => '', 'error' => 'You are not allowed to perform this operation');