PHP code example of sagittariusx / beluga.drawing.image.exif

1. Go to this page and download the library: Download sagittariusx/beluga.drawing.image.exif library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sagittariusx / beluga.drawing.image.exif example snippets


// Init the PHP only loader that get the data directly without d the META data from a image
$data = $loader->load( __DIR__ . '/IMG_0169-2.JPG' );

// Debug output the META data
print_r( $data );

// Init the loader
$loader = new \Beluga\Drawing\Image\Exif\Loader\ExifTool();

if ( ! $loader->isConfigured() )
{
   // Exiftool is not known to the system, declare it manually
   try
   {
      $loader->configure( [ 'path' => '\usr\local\bin\exiftool' ] );
   }
   catch ( \Throwable $ex ) { echo $ex; exit; }
}

if ( ! $loader->isConfigured() )
{
   // The loader for exiftool is not configured right
   // Use the PHP loader as fallback. It will always do the job
   $loader = new \Beluga\Drawing\Image\Exif\Loader\PHP();
}


// Load the META data from a image
$data = $loader->load( __DIR__ . '/IMG_0169-2.JPG' );

// Debug output the META data
print_r( $data );

// Init the JSon sidecar files loader
$loader = new \Beluga\Drawing\Image\Exif\Loader\JSon();

// Load the META data from a image
$data = $loader->load( __DIR__ . '/IMG_0169-2.JPG' );

// Debug output the META data
print_r( $data );