public function loadBinaryString($data)
{
$this->resource = @imagecreatefromstring($data);
if ($this->resource === false) {
throw new \InvalidArgumentException("Passed binary string is empty or is not a valid image");
}
}