You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the following code to obtain the HEX hash:
<?php
header('Content-Type: text/plain');
require_once('vendor/autoload.php');
use Jenssegers\ImageHash\ImageHash;
use Jenssegers\ImageHash\Implementations\DifferenceHash;
function getPhotoDuplicate($hasher, $dir)
{
$fileList = array();
$allowedExtensions = ['jpg', 'jpeg'];
foreach (new DirectoryIterator($dir) as $file) {
if ($file->isDir() || $file->isDot() || !in_array($file->getExtension(), $allowedExtensions, true)) {
continue;
}
$path = $file->getFilename();
echo $path . PHP_EOL; // this is working
$hash = $hasher->hash($path);
$fileList[$path] = $hash->toHex();
}
return $fileList;
}
$hasher = new ImageHash(new DifferenceHash());
$files = getPhotoDuplicate($hasher, '/Volumes/MyUSB/Some/Folder/Here/');
print_r($files);
?>
Actually the code is quite straightforward, which loops through a directory containing a thousand images.
The same code works on local directory (e.g. same directory .), but not on remote USB-connected directory. The same set of images is used. The error is as follow:
PHP Fatal error: Uncaught Intervention\Image\Exception\NotReadableException: Image source not readable in /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php:346
Stack trace:
#0 /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(66): Intervention\Image\AbstractDecoder->init('1000202606_1583...')
#1 /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/ImageManager.php(54): Intervention\Image\AbstractDriver->init('1000202606_1583...')
#2 /Volumes/MyUSB/Some/Folder/Here/vendor/jenssegers/imagehash/src/ImageHash.php(35): Intervention\Image\ImageManager->make('1000202606_1583...')
#3 /Volumes/MyUSB/Some/Folder/Here/photo_duplicate.php(17): Jenssegers\ImageHash\ImageHash->hash('1000202606_1583...')
#4 /Volumes/MyUSB/Some/Folder/Here/photo_duplicate.php(24): getPhotoDuplicate(Object(Jenssegers\ImageHash\ImageHash), '/Volumes/MyUSB...')
#5 {main}
thrown in /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php on line 346
Fatal error: Uncaught Intervention\Image\Exception\NotReadableException: Image source not readable in /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php:346
Stack trace:
#0 /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(66): Intervention\Image\AbstractDecoder->init('1000202606_1583...')
#1 /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/ImageManager.php(54): Intervention\Image\AbstractDriver->init('1000202606_1583...')
#2 /Volumes/MyUSB/Some/Folder/Here/vendor/jenssegers/imagehash/src/ImageHash.php(35): Intervention\Image\ImageManager->make('1000202606_1583...')
#3 /Volumes/MyUSB/Some/Folder/Here/photo_duplicate.php(17): Jenssegers\ImageHash\ImageHash->hash('1000202606_1583...')
#4 /Volumes/MyUSB/Some/Folder/Here/photo_duplicate.php(24): getPhotoDuplicate(Object(Jenssegers\ImageHash\ImageHash), '/Volumes/MyUSB...')
#5 {main}
thrown in /Volumes/MyUSB/Some/Folder/Here/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php on line 346
Is this a bug? or did I miss something?
Using PHP 7.4.10, GMP 6.2.0 on macOS Catalina 10.15.6
The text was updated successfully, but these errors were encountered:
I am using the following code to obtain the HEX hash:
Actually the code is quite straightforward, which loops through a directory containing a thousand images.
The same code works on local directory (e.g. same directory
.
), but not on remote USB-connected directory. The same set of images is used. The error is as follow:Is this a bug? or did I miss something?
Using PHP 7.4.10, GMP 6.2.0 on macOS Catalina 10.15.6
The text was updated successfully, but these errors were encountered: