Skip to content

Instantly share code, notes, and snippets.

@aertmann
Created May 10, 2012 15:13
Show Gist options
  • Save aertmann/2653813 to your computer and use it in GitHub Desktop.
Save aertmann/2653813 to your computer and use it in GitHub Desktop.
<?php
try {
$imageSize = getimagesize('resource://' . $this->resource->getResourcePointer()->getHash());
if ($imageSize === FALSE) {
throw new \TYPO3\Media\Exception('The given resource was not a valid image file');
}
$this->width = (integer)$imageSize[0];
$this->height = (integer)$imageSize[1];
$this->type = (integer)$imageSize[2];
} catch(\TYPO3\Media\Domain\Model\Exception\InvalidImageContentException $exception) {
throw new \TYPO3\Media\Exception($exception->getMessage(), $exception->getCode());
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment