我在显示图像方面遇到问题。
$url = Storage::disk(config("constants.DEFAULT_STORAGE"))->get(config("constants.EMPLOYEES_IMAGES").$form->id.'/'. $form->image->get(0)->path);
<img src="{{ $url }}">
完成此操作后,我得到以下内容...
A.N6.c.QH.a.?4$��3..H.a.c.Dz.QFα.N。} 5.Hc.Q?)。 ��FN��i0WF?S�vHsE6 \ 8#gϚ��=�Syi������K�W�c���(�9�i�n��(2��cȥ4l[��h�*6O�iJ+����(�0�Z\��(�g��R'VC�>($�)0<����\� �ԩ#w�ȧ���!)F�#�@�u0.F(:��v�Y�#��X2L�<�\�.��,�5�e=��q:�Q�I�A��Pu��o�#��I���Tg�ڹ��D�����qi�6�M����ڃZ��{���� Eg�Ո���/���Oբ�Ll�=�A'�0�#�ڝR���
��ڒ&.. N��A$ f $��rrf|| !!>h`m�-��“]
需要一些帮助。
问候,
凯文
我认为您想要:
$url = Storage::url(<pathToImage>);
否则,您可能会得到实际的图像(您所拥有的图像)
您需要使用Storage::url()
。
$url = Storage::url(config("constants.EMPLOYEES_IMAGES") . $form->id . '/' . $form->image->get(0)->path);
Storage::url()
用于获取文件URL,Storage::get()
用于获取文件内容。