A_Dynamic_Thumbnails_Storage_Driver

Class A_Dynamic_Thumbnails_Storage_Driver.

Defined (1)

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

/products/photocrati_nextgen/modules/dynamic_thumbnails/package.module.dynamic_thumbnails.php  
  1. class A_Dynamic_Thumbnails_Storage_Driver extends Mixin 
  2. function get_image_abspath($image, $size = FALSE, $check_existance = FALSE) 
  3. $retval = NULL; 
  4. $dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance(); 
  5. if ($dynthumbs && $dynthumbs->is_size_dynamic($size)) { 
  6. // If we have the id, get the actual image entity 
  7. if (is_numeric($image)) { 
  8. $image = $this->object->_image_mapper->find($image); 
  9. // Ensure we have the image entity - user could have passed in an 
  10. // incorrect id 
  11. if (is_object($image)) { 
  12. if ($folder_path = $this->object->get_cache_abspath($image->galleryid)) { 
  13. $params = $dynthumbs->get_params_from_name($size, true); 
  14. $image_filename = $dynthumbs->get_image_name($image, $params); 
  15. $image_path = implode(DIRECTORY_SEPARATOR, array(rtrim($folder_path, "\\/"), $image_filename)); 
  16. if ($check_existance) { 
  17. if (@file_exists($image_path)) { 
  18. $retval = $image_path; 
  19. } else { 
  20. $retval = $image_path; 
  21. } else { 
  22. $retval = $this->call_parent('get_image_abspath', $image, $size, $check_existance); 
  23. return $retval; 
  24. function get_image_url($image, $size = 'full', $check_existance = FALSE) 
  25. $retval = NULL; 
  26. $abspath = FALSE; 
  27. $dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance(); 
  28. if ($dynthumbs && $dynthumbs->is_size_dynamic($size)) { 
  29. $abspath = $this->object->get_image_abspath($image, $size, true); 
  30. // If abspath is NULL, then we assume we're dealing with a dynamic image 
  31. if ($abspath == null) { 
  32. $params = $dynthumbs->get_params_from_name($size, true); 
  33. $retval = $dynthumbs->get_image_url($image, $params); 
  34. } else { 
  35. $check_existance = FALSE; 
  36. if ($retval == null) { 
  37. $retval = $this->call_parent('get_image_url', $image, $size, $check_existance, $abspath); 
  38. // Try generating the thumbnail 
  39. if ($retval == null) { 
  40. $params = array('watermark' => false, 'reflection' => false, 'crop' => true); 
  41. $result = $this->generate_image_size($image, $size, $params); 
  42. if ($result) { 
  43. $retval = $this->call_parent('get_image_url', $image, $size, $check_existance); 
  44. return $retval; 
  45. function get_image_dimensions($image, $size = 'full') 
  46. $retval = $this->call_parent('get_image_dimensions', $image, $size); 
  47. if ($retval == null) { 
  48. $dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance(); 
  49. if ($dynthumbs && $dynthumbs->is_size_dynamic($size)) { 
  50. $new_dims = $this->object->calculate_image_size_dimensions($image, $size); 
  51. $retval = array('width' => $new_dims['real_width'], 'height' => $new_dims['real_height']); 
  52. return $retval; 
  53. function get_image_size_params($image, $size, $params = null, $skip_defaults = false) 
  54. $dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance(); 
  55. if ($dynthumbs && $dynthumbs->is_size_dynamic($size)) { 
  56. $named_params = $dynthumbs->get_params_from_name($size, true); 
  57. foreach ($named_params as $param_name => $param_value) { 
  58. $params[$param_name] = $param_value; 
  59. return $this->call_parent('get_image_size_params', $image, $size, $params, $skip_defaults);