Image in blob does not appear

Asked

Viewed 285 times

0

I need to make my images appear on tag img however only a few appears, I’ve taken all the css and it’s no problem in this.

Below the photo that testifies that html is understanding the image: inserir a descrição da imagem aqui

On my page I’m calling the pictures like this:

@foreach($produto->imagens as $imagen)
    @if($imagen->FlgPrincipal == 0)
       <div class="col-md-3">
          <img src="{{$imagen->BLOB}}" class="img-responsive img-normal">
       </div>
    @elseif($imagen->FlgPrincipal == 1)
       <div class="col-md-5">
          <img src="{{$imagen->BLOB}}" class="img-responsive img-principal">
       </div>
    @endif
@endforeach

What could possibly be going on? I’m basically using the framework Laravel

  • If you right-click on the image and have the image displayed on its own?

  • yes, she displays perfectly

  • @Virgilionovic Something crazy is that when I refresh the page some other goes away, and some other appears, more without defined pattern

  • apparently the size of the image affects, how to solve this ?

  • You have to standardize the size

  • How can I do this ? Using Laravel as a framework ? Know how to reduce image quality if the user sends something with high quality ?

  • http:/itsolutionstuff.com/post/laravel-5-image-uploadand-resize-example-using-intervention-image-packageexample.html take a look at this tutorial and I’ve already done an example here

  • @Virgilionovic my business is with blob, will it work ?

  • Actually it’s okay, the images are of different size and need to have a pattern of size, shape and quality. Work.if you do the process before recording in the bank

Show 4 more comments

1 answer

-1

Well, first of all, to insert a blob file into the table, you need to use the native php function file_get_contents().

Exemplifying:

"INSERT INTO tabela(imagem) VALUES ( file_get_contents($imagem) )";

And to display:

echo '';

Or:

header("Content-Type: image/jpg");
echo base64_encode($row['imagem']);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.