symfony - Convert photo name to photo url -
i have place entity uploadable photo :
/** * @orm\column(type="string", length=255) * @var string * @apiproperty(iri="http://schema.org/photo") * @groups({"read"}) */ private $photo; /** * @vich\uploadablefield(mapping="image", filenameproperty="photo") * @var file * @assert\notblank() * @assert\file( * maxsize = "1024k", * ) */ private $photofile;
when request api photo name of entity, want photo url (absolute url) exploit directly in angular application. vich uploader has helper retrieve path of photo can't directly in method getphoto(), how can ?
you add event subscriber that, listening on get /places
if there photofile
, computing helper , populate non-persisted field called photourl.
Comments
Post a Comment