/** * we move this function out of the constructor because it can fail. The clean way would * be to throw an exception which is not possible in PHP4. We therefore might have to resort * to a factory method and do error checking there. */ function initImageSizes() { if (file_exists($this->_path)) { //set original width and height $imageAttr = getimagesize($this->_path); $this->_width = $imageAttr[0]; $this->_height = $imageAttr[1]; } else { //we have a problem the photo does not exist at the specified location $this->_raisePhotoNotFoundError(); $this->_width = 0; $this->_height = 0; } //add all the image sizes foreach ($this->_oc->getImageSizeNames() as $sizeName) { $this->_sizes[$sizeName] =& PhotoQImageSize::createInstance($sizeName, $this->imgname, $this->_yearMonthDir, $this->_width, $this->_height); } //add the original $this->_sizes[$this->_oc->ORIGINAL_IDENTIFIER] =& PhotoQImageSize::createInstance($this->_oc->ORIGINAL_IDENTIFIER, $this->imgname, $this->_yearMonthDir, $this->_width, $this->_height); }
/** * PHP5 type constructor */ function __construct($name, $imgName, $yearMonthDir, $width, $height) { parent::__construct($name, $imgName, $yearMonthDir, $width, $height); $this->_constrFixed = $this->_oc->getValue($name . '-imgFixed'); }