note 127008 rejected from function.json-decode by cmb
| From: | cmb@php.net | Date: | Mon, 25 Apr 2022 08:41:07 +0000 |
| Subject: | note 127008 rejected from function.json-decode by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218312@lists.php.net to get a copy of this message | ||
Note Submitter: edmer_184 at hotmail dot com
----
I have been working with php v8.1.5 and this happens:
I have these addresses saved in the "products" table in the image_path field (3 sizes):
{\"thumb\":\"\\/public\\/products\\/strawberry-pulp.png-thumb.png\",\"medium\":\"\\/public\\/products
\\/strawberry-pulp.png-medium.png\",\"full\":\"\\/public\\/products\\/strawberry-pulp.png-full.png\"}
I want to retrieve "medium" size images with this code.
data-src="{{ url('images'.json_decode($p->image_path)->medium) }}"
But I get this error:
Attempt to read property "medium" on null
What is the right way?