Skip to content

Instantly share code, notes, and snippets.

@rexxars rexxars/gist:3748547
Created Sep 19, 2012

Embed
What would you like to do?
Imbo try/catch with imageExists
<?php
$fileName = 'someImage.png';
try {
if ($imbo->imageExists($fileName)) {
$photoHash = $imbo->getImageIdentifier($fileName);
} else {
$response = $imbo->addImage($fileName);
$photoHash = $response->getImageIdentifier();
}
echo 'Image available at ' . $imbo->getImageUrl($photoHash)->jpg() . PHP_EOL;
} catch (ImboClient\Exception $e) {
echo 'Failed to add image: ' . $e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.