Display image stored in BLOB database in symfony

前端 未结 4 1009
温柔的废话
温柔的废话 2021-01-21 10:19

I load my image (blob data ) in my GETer Entity When I just return ($this->foto) in my GETer I see :Resource id #284 on the screen When I change my GETer like this : return stre

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-21 10:28

    in your entity write your image getter like this:

    public function getFoto()
    {
        return imagecreatefromstring($this->foto);
    }
    

    and use it instead of the object "foto" property.

    php doc for the function: http://php.net/manual/de/function.imagecreatefromstring.php

提交回复
热议问题