Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
xwiz authored Apr 3, 2017
1 parent b56b757 commit 9bc3ba9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions phash.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,21 @@ public function getHash($filepath)
{
$scale = 8;//todo, allow scale specification
$img = file_get_contents ( $filepath );
if (! $img) {
if (! $img)
{
return 'failed to load ' . $filepath;
}
$img = imagecreatefromstring ( $img );
if (! $img) {
if (! $img)
{
// error, unsupported format.
$supportedFormats = '';
$needle = 'Support';
$needleLen = strlen ( $needle );
foreach ( gd_info () as $key => $val ) {
if (! $val || strlen ( $key ) <= $needleLen || substr ( $key, - $needleLen ) !== $needle) {
foreach ( gd_info () as $key => $val )
{
if (! $val || strlen ( $key ) <= $needleLen || substr ( $key, - $needleLen ) !== $needle)
{
continue;
}
$supportedFormats .= trim ( substr ( $key, 0, strlen ( $key ) - $needleLen ) ) . ', ';
Expand Down

0 comments on commit 9bc3ba9

Please sign in to comment.