how to orient image using intervation image [closed]

0

I need something to orient the image correctly and then to appear. I'm using laravel and image intervation

 <?php 

$img = Image::make("{{$file->caminho}}{{$file->nome}}")-orientate(); 
               ?>

<img src="{{ $img }}"/>

But I can not

    
asked by anonymous 27.08.2017 / 20:25

2 answers

0

For those of you who want to use image intervation and target photos, do the following

create a link to the image, in my case I'm passing the ID.

  

a href="user / previewLarge / {{$ file-"> id}}" >

create the route:

   get ('user / preview / {fileId}', '' '' '' files.preview ',' uses '= &' 'FilesController @ preview' auth ');

create the controller

public function preview ($ fileId) {

    $file = \App\Files::find($fileId);

    $finalPath = $file->caminho.'/'.$file->nome;

     $mime = mime_content_type($finalPath); //pega o tipo do arquivo e se for jpeg, fará o processo de orientação.

        if($mime == "image/jpeg")
        {

              return $image = Image::make($finalPath)
                    ->orientate()
                    ->resize(150, 200)
                    ->encode('data-url',0)->response();
        }
        else{

              return $image = Image::make($finalPath)->encode('data-url',0)->response();

        }

}

With me it worked, thank you all!

    
02.09.2017 / 03:21
0

You're trying to use syntax blade within php , and you do not need > to access a property or method.

<?php
     $img = Image::make($file->caminho . $file->nome)->orientate();
?>
    
27.08.2017 / 20:32