Gino Multimedia  0.1
Modulo di gestione di contenuti multimediali per Gino CMS
 Tutto Strutture dati File Funzioni Variabili Gruppi Pagine
class.multimediaImageField.php
Vai alla documentazione di questo file.
1 <?php
18 class multimediaImageField extends imageField {
19 
24 
29 
36  function __construct($options) {
37 
38  parent::__construct($options);
39 
40  $this->_thumb = false;
41 
42  $this->_side_dimension = gOpt('side_dimension', $options, 200);
43  $this->_apply_on_thumb = gOpt('apply_on_thumb', $options, false);
44  }
45 
60  protected function saveImage($filename, $prefix_file, $prefix_thumb, $new_width, $new_height, $thumb_width, $thumb_height){
61 
62  $thumb = (is_null($thumb_width) && is_null($thumb_height) && !$this->_apply_on_thumb) ? false : true;
63  $file = $this->_directory.$filename;
64  list($im_width, $im_height, $type) = getimagesize($file);
65 
66  if($im_width >= $im_height) {
67  if($this->_apply_on_thumb) {
68  $thumb_width = $this->_side_dimension;
69  $thumb_height = null;
70  }
71  else {
72  $new_width = $this->_side_dimension;
73  $new_height = null;
74  }
75  }
76  else {
77  if($this->_apply_on_thumb) {
78  $thumb_height = $this->_side_dimension;
79  $thumb_width = null;
80  }
81  else {
82  $new_height = $this->_side_dimension;
83  $new_width = null;
84  }
85  }
86 
87  return parent::saveImage($filename, $prefix_file, $prefix_thumb, $new_width, $new_height, $thumb_width, $thumb_height);
88  }
89 }
90 
91 ?>