Be part of JetBrains PHPverse 2026 on June 9 โ€“ a free online event bringing PHP devs worldwide together.

gobs's avatar
Level 1

how I create a link to the images in the dropbox

how do I link to the images in the dropbox using laravel? I followed the laravel documentation and uploaded the images to the dropbox, but I don't know how to show these images. Someone PLEASE HELP ME.

0 likes
18 replies
gobs's avatar
Level 1

No, I installed what is in the documentation. Could you help me how to use it? Can I use it in the project I already did or do I have to start over?

Sinnbeck's avatar

Sorry I am confused. Are you planning on using Dropbox? Or local storage? Or something else?

1 like
gobs's avatar
Level 1

I tried to use those lines of code, but it didn't work. I need to take all the images inside and show them in the view. I was able to show only the name, the image I couldn't. I've been researching for hours and saw that you have to create a link, but I don't know how to do that

Sinnbeck's avatar

Does this not work? (what does it give you?)

$url = Storage::disk('dropbox')->url('file.jpg');
1 like
gobs's avatar
Level 1

I believe it works, but that way you are specifying an image. I tried to put the variable that is an array with all the ones in the dropbox, but it didn't work.

gobs's avatar
Level 1

I'll try, thanks for listening.

MichalOravec's avatar
$directory = 'your-directory';

$allImages = collect(Storage::disk('dropbox')->files($directory))->map(function($image) {
    return Storage::disk('dropbox')->url($image);
});
@foreach($allImages as $image)
   <img src="{{ $image }}" alt>
@endforeach
1 like
gobs's avatar
gobs
OP
Best Answer
Level 1

OMG It worked. THANK YOU VERY MUCH MICHAEL I did it and it worked:

   $allFiles = collect(Storage::disk('dropbox')->files('arquivo'))->map(function($file) {
        return Storage::disk('dropbox')->url($file);
    });

return view('welcome', [
        'allFiles' => $allFiles,
    ]);
jlrdw's avatar

Also are these user images that only the logged in user has rights to. If so you will need handle this using authorization.

Or can anyone view the images? That makes a difference on how you handle displaying them.

1 like
gobs's avatar
Level 1

Not in this project. It is a website of a construction company, and this site will present the works carried out.

gobs's avatar
Level 1

Thank you all for your attention

Sinnbeck's avatar

@gobs it isn't nice to simply take the answer by @michaloravec and post it as your own and then marking it as the best answer. That sort of thing, makes people less likely to help you next time you have a problem

Please or to participate in this conversation.