imagenes2.php 992 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. use Aws\S3\S3Client;
  3. use League\Flysystem\AwsS3v3\AwsS3Adapter;
  4. use League\Flysystem\Filesystem;
  5. include __DIR__ . '/vendor/autoload.php';
  6. $client = new S3Client([
  7. 'credentials' => [
  8. 'key' => 'iksop',
  9. 'secret' => '8htoiwn44g204th' ],
  10. 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
  11. 'use_path_style_endpoint' => true,
  12. 'region' => 'sa-east-1',
  13. 'version' => 'latest',]);
  14. $adapter = new AwsS3Adapter($client, 'comp');
  15. $filesystem = new Filesystem($adapter);
  16. try{
  17.         $img = $filesystem->readStream($_SERVER["PATH_INFO"]);
  18.         header("Content-Type: image/png");
  19.         echo stream_get_contents($img);
  20. }catch(League\Flysystem\FileNotFoundException $e){
  21.         $contents = $filesystem->listContents(dirname($_SERVER["PATH_INFO"]));
  22.         foreach($contents as $content){
  23.                 ($content["path"]);
  24.         }
  25. }