569570571572573574575576577578579580581582583584585586587 * @param string the operation initiating the creation
*
* @return resource
*
* @throws RuntimeException
*
*/
private function createImage(BoxInterface $size, $operation)
{
$resource = imagecreatetruecolor($size->getWidth(), $size->getHeight());
if (false === $resource) {
throw new RuntimeException('Image '.$operation.' failed');
}
if (false === imagealphablending($resource, false) || false === imagesavealpha($resource, true)) {
throw new RuntimeException('Image '.$operation.' failed');
}