Coder Social home page Coder Social logo

Comments (8)

jenssegers avatar jenssegers commented on August 16, 2024 1

Looks like an issue with your php installation.

from imagehash.

ppKrauss avatar ppKrauss commented on August 16, 2024

Ok, a workaround resolved.. Now the problem is about use clause position and path, at my projetc/src folder where I run composer require jenssegers/imagehash now I have as ls:

composer.json  composer.lock   sync.php  
vendor
  autoload.php  
  composer 
  jenssegers
       imagehash
          composer.json  README.md  
          src
              ImageHash.php  Implementation.php  Implementations

Them, at my projects folder I run php sync.php ... ERROR

PHP Fatal error: Uncaught Error: Class 'Jenssegers\ImageHash\ImageHash' not found

from imagehash.

ppKrauss avatar ppKrauss commented on August 16, 2024

Ok, fixed the problem with require __DIR__ . '/vendor/autoload.php' ... So the real problem/suggestion is:

if you see as support, I can add or suggest text for "A Dummy's Guide To Install and use imagehash"

from imagehash.

wouterds avatar wouterds commented on August 16, 2024

That's not really a problem related to this package. When using a package with composer you are assumed to know at least how to include the composer autoloader.

from imagehash.

faizanjaved5 avatar faizanjaved5 commented on August 16, 2024
require __DIR__ . '/vendor/autoload.php';
$hasher = new ImageHash;
$hash = $hasher->hash('img/img1.jpg');
$hash2 = $hasher->hash('img/img2.jpg');
$distance = $hasher->distance($hash1, $hash2);
echo $distance;

this is my code but still iam getting this error

Fatal error: Uncaught Error: Class 'ImageHash' not found

from imagehash.

wouterds avatar wouterds commented on August 16, 2024

@sppidy Did you install the package?

composer require jenssegers/imagehash

from imagehash.

faizanjaved5 avatar faizanjaved5 commented on August 16, 2024

@wouterds yes i installed it

from imagehash.

pastyr-32 avatar pastyr-32 commented on August 16, 2024

@sppidy you still need to add a use statement due to namespaces. Add the following code after your require statement.

use ImageHash;

So it will look like this:

require __DIR__ . '/vendor/autoload.php';
use ImageHash;
$hasher = new ImageHash;

Also, most modern IDE's will alert you to this need and offer auto-fill capabilities. I suggest PHPStorm.

from imagehash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.