$arguments['height'
] =
(int) round($arguments['height'
]);
// Fail when width or height are 0 or negative.
if ($arguments['width'
] <= 0
) { throw new \
InvalidArgumentException("Invalid width ('{
$arguments['width'
]}') specified for the image 'create_new' operation"
);
} if ($arguments['height'
] <= 0
) { throw new \
InvalidArgumentException("Invalid height ({
$arguments['height'
]}) specified for the image 'create_new' operation"
);
} // Assure transparent color is a valid hex string.
if ($arguments['transparent_color'
] && !Color::
validateHex($arguments['transparent_color'
])) { throw new \
InvalidArgumentException("Invalid transparent color ({
$arguments['transparent_color'
]}) specified for the image 'create_new' operation"
);
} return $arguments;
} /**
* {@inheritdoc}
*/
protected function execute(array
$arguments) { // Get the image type.