Beispiel #1
0
 /**
  * @param KrakenOptions $options
  * @param KrakenImage   $image
  *
  * @return CompressResponse
  */
 public static function fromFile(KrakenOptions $options, KrakenImage $image)
 {
     $apiEndpoint = sprintf('%s/upload', self::API_URL);
     $file = class_exists('CURLFile') ? new \CURLFile($image->getPath()) : sprintf('@%s', $image->getPath());
     $curl = new Curl();
     $curl->post($apiEndpoint, ['file' => $file, 'data' => json_encode($options->getConfiguredOptions())]);
     return self::parseResponse($curl);
 }
Beispiel #2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use MikeyMike\Kraken\KrakenOptions;
use MikeyMike\Kraken\Request\Compress;
use MikeyMike\Kraken\KrakenImage;
$options = new KrakenOptions('api_key', 'api_secret');
// Configure Options
$options->useDevelopment();
$response = Compress::fromFile($options, KrakenImage::fromPath('kraken-logo.png'));
var_dump($krakenResponse);
Beispiel #3
0
 /**
  * @param $invalidBg
  * @expectedException \InvalidArgumentException
  * @dataProvider invalidBackgroundProvider
  */
 public function testConvertToWillThrowExceptionOnInvalidBackgroundValue($invalidBg)
 {
     $krakenOptions = new KrakenOptions('fake_key', 'fake_secret');
     $krakenOptions->convertTo('gif', $invalidBg);
 }
Beispiel #4
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use MikeyMike\Kraken\KrakenOptions;
use MikeyMike\Kraken\Request\Compress;
$options = new KrakenOptions('api_key', 'api_secret');
// Configure Options
$options->useDevelopment();
$response = Compress::fromUrl($options, 'https://kraken-nekkraug.netdna-ssl.com/assets/images/kraken-logo-4@2x.png');
var_dump($krakenResponse);