private function _flip($orientation)
{
// if image resource was successfully created
if ($this->_create_from_source()) {
// prepare the target image
$target_identifier = $this->_prepare_image($this->source_width, $this->source_height, -1);
// flip according to $orientation
switch ($orientation) {
case 'horizontal':
imagecopyresampled($target_identifier, $this->source_identifier, 0, 0, $this->source_width - 1, 0, $this->source_width, $this->source_height, -$this->source_width, $this->source_height);
break;
case 'vertical':
imagecopyresampled($target_identifier, $this->source_identifier, 0, 0, 0, $this->source_height - 1, $this->source_width, $this->source_height, $this->source_width, -$this->source_height);
break;
case 'both':
imagecopyresampled($target_identifier, $this->source_identifier, 0, 0, $this->source_width - 1, $this->source_height - 1, $this->source_width, $this->source_height, -$this->source_width, -$this->source_height);
break;
}
// write image
return $this->_write_image($target_identifier);
}
// if script gets this far, return false
// note that we do not set the error level as it has been already set
// by the _create_from_source() method earlier
return false;
}