php - Object of class ORM could not be converted to string <img src -
so i'm new lot of this. php , idorm. searched far , wide i'm not seeing answer specific problem.
object of class orm not converted string.
the slim error pops @ php code $picture.
this in html view
<div class="profile-left"> <div class="profile-image"> <img src="<?= empty($picture) ? '/static/images/profile-default.png' : $picture ?>"/> <i class="fa fa-user hide"></i> </div> <div class="m-b-10"> <button class="btn btn-warning btn-block btn-sm" type="button" id="change_picture" data-toggle="modal" href="#change-picture-modal">change picture</button> </div> </div>
this route $picture in file
$picture = orm::for_table('picture') ->where('picture_gallery_id', $user->account_id) ->where('name', $user->account_id . ':profile') ->find_one(); $params = array_merge( get_base_params('account', 'edit profile'), [ 'picture' => $picture, ]);
the data saved in postgres table bytea.
i'm quite sure missing in noob-ishness. thank in advance help.
assuming orm returns picture object of type, var_dump()
variable $picture
, see fields available if don't know structure of picture
table.
your issue error indicates, $picture
object, template system expects string (or casts string). want pass in string property of $picture
object want displayed:
$params = array_merge( get_base_params('account', 'edit profile'), [ 'picture' => $picture->some_property, ]);
there chance orm library isn't finding picture , returning instance of or somehting.
Comments
Post a Comment