PHP code example of viraj / hawkeye

1. Go to this page and download the library: Download viraj/hawkeye 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/ */

    

viraj / hawkeye example snippets




return [
    'hawkeye_base_path' => 'images/',
    'images' => [
        'banner' => '1200x800',
        'thumbnail' => '300x200',
        'large' => '600x500',
    ],
];



use Viraj\Hawkeye\HawkeyeFacade as Hawkeye;

public function uploadFile()
{
    $files = Hawkeye::upload('file_upload')->resize()->get();
    var_dump($files);
}

array (size=2)
  'list' => 
    array (size=8)
      0 => string 'd67d8ab4f4c10bf22aa353e27879133c.png' (length=36)
      1 => string 'd645920e395fedad7bbbed0eca3fe2e0.png' (length=36)
      2 => string 'd67d8ab4f4c10bf22aa353e27879133c_1200_800.png' (length=45)
      3 => string 'd67d8ab4f4c10bf22aa353e27879133c_300_200.png' (length=44)
      4 => string 'd67d8ab4f4c10bf22aa353e27879133c_600_500.png' (length=44)
      5 => string 'd645920e395fedad7bbbed0eca3fe2e0_1200_800.png' (length=45)
      6 => string 'd645920e395fedad7bbbed0eca3fe2e0_300_200.png' (length=44)
      7 => string 'd645920e395fedad7bbbed0eca3fe2e0_600_500.png' (length=44)
  'separated' => 
    array (size=2)
      0 => 
        array (size=4)
          'original' => string 'd67d8ab4f4c10bf22aa353e27879133c.png' (length=36)
          'banner' => string 'd67d8ab4f4c10bf22aa353e27879133c_1200_800.png' (length=45)
          'thumbnail' => string 'd67d8ab4f4c10bf22aa353e27879133c_300_200.png' (length=44)
          'large' => string 'd67d8ab4f4c10bf22aa353e27879133c_600_500.png' (length=44)
      1 => 
        array (size=4)
          'original' => string 'd645920e395fedad7bbbed0eca3fe2e0.png' (length=36)
          'banner' => string 'd645920e395fedad7bbbed0eca3fe2e0_1200_800.png' (length=45)
          'thumbnail' => string 'd645920e395fedad7bbbed0eca3fe2e0_300_200.png' (length=44)
          'large' => string 'd645920e395fedad7bbbed0eca3fe2e0_600_500.png' (length=44)



use Viraj\Hawkeye\HawkeyeFacade as Hawkeye;

public function uploadFile()
{
    $files = Hawkeye::upload('file_upload')->resize()->getList();
    var_dump($files);
}


array (size=8)
      0 => string 'd67d8ab4f4c10bf22aa353e27879133c.png' (length=36)
      1 => string 'd645920e395fedad7bbbed0eca3fe2e0.png' (length=36)
      2 => string 'd67d8ab4f4c10bf22aa353e27879133c_1200_800.png' (length=45)
      3 => string 'd67d8ab4f4c10bf22aa353e27879133c_300_200.png' (length=44)
      4 => string 'd67d8ab4f4c10bf22aa353e27879133c_600_500.png' (length=44)
      5 => string 'd645920e395fedad7bbbed0eca3fe2e0_1200_800.png' (length=45)
      6 => string 'd645920e395fedad7bbbed0eca3fe2e0_300_200.png' (length=44)
      7 => string 'd645920e395fedad7bbbed0eca3fe2e0_600_500.png' (length=44)




use Viraj\Hawkeye\HawkeyeFacade as Hawkeye;

public function uploadFile()
{
    $files = Hawkeye::upload('file_upload')->resize(['banner', 'large'])->get();
    var_dump($files);
}

array (size=2)
  'list' => 
    array (size=6)
      0 => string 'a5bfc9e07964f8dddeb95fc584cd965d.png' (length=36)
      1 => string 'a5771bce93e200c36f7cd9dfd0e5deaa.png' (length=36)
      2 => string 'a5bfc9e07964f8dddeb95fc584cd965d_1200_800.png' (length=45)
      3 => string 'a5bfc9e07964f8dddeb95fc584cd965d_600_500.png' (length=44)
      4 => string 'a5771bce93e200c36f7cd9dfd0e5deaa_1200_800.png' (length=45)
      5 => string 'a5771bce93e200c36f7cd9dfd0e5deaa_600_500.png' (length=44)
  'separated' => 
    array (size=2)
      0 => 
        array (size=3)
          'original' => string 'a5bfc9e07964f8dddeb95fc584cd965d.png' (length=36)
          'banner' => string 'a5bfc9e07964f8dddeb95fc584cd965d_1200_800.png' (length=45)
          'large' => string 'a5bfc9e07964f8dddeb95fc584cd965d_600_500.png' (length=44)
      1 => 
        array (size=3)
          'original' => string 'a5771bce93e200c36f7cd9dfd0e5deaa.png' (length=36)
          'banner' => string 'a5771bce93e200c36f7cd9dfd0e5deaa_1200_800.png' (length=45)
          'large' => string 'a5771bce93e200c36f7cd9dfd0e5deaa_600_500.png' (length=44)