New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

How to get asset path

Asko Nõmm January 25, 2021 by Asko Nõmm

I have a Blueprint for CP and in it I have an assets fieldType, but when I'm retrieving info via $blueprint->get('assetName')->raw(); I only get back the file name, but no info on the path of where that file is or anything. How would one go about finding the image path like this?

For now I solved it by doing public_path('assets/' . $fileName) but it's a bad solution because it doesn't consider what if the user has a different location for the assets, like an S3 or something.

Answered by Asko Nõmm!
>>>>>>> Answered <<<<<<<
4 Replies
2 Followers