bobmyles
1939
15
Laravel

How to upload an image and display as logo

Posted 2 years ago by bobmyles

I am using Laravel 5.4. I am creating organizations; whose details include a logo.

The intention is when a user for the organization logs in, the logo is on the display.

I am able to upload and save the logo on storage/app/logos/organization_name/logo... eg storage/logos/Abc/logo.jpg

However, I am not able to pick and display the image/logo for an organization. I have gone through the docs https://laravel.com/docs/5.3/requests#retrieving-uploaded-files but still struggling.

Kindly someone save my day.

Image Upload and save code below:

  $org_image = $request->org_image;

        if ($org_image !== null) {
            $fileext = $org_image->getClientOriginalExtension(); //Get file extension
            $org_image->storeAs('logos/' . $organization_name, "logo.{$fileext}"); //save file 
     
         }

How do I fetch and display this on the view diffentiating by the organization name?

Regards.

Please sign in or create an account to participate in this conversation.