✅ What's a good strategy to load serverside resources into your controller?
Right now I have a few images and videos that so far i've been loading to views using Directory calls. I was thinking it's about time i start doing some caching. Im just thinking I wouldnt want the directory/file stack to be linked to the controller at all, feels like it's not the place for it. So what's a good approach to loading static resources like images/videos/etc?
4 Replies
Why do you need those things in the controller?
You usually just dump the files to
/wwwroot
so ASP serves them automatically and that's that
You maybe use a BLOB storage like Backblaze B2 or AWS S3I've got some models that are coupled to views the idea is to eventually start implementing some client cookies which would tell the controller via request how the enduser is browsing the site which would alter the resources in the model
But yeah this is what i didn't really understand i suppose, they get served with the request, meaning i just run strings in the model itself and alter the relative path
thanks c:
Also, if you mean to for example serve different images to mobile users vs desktop users, just use the
picture
It lets you define multiple different files and use media queries to decide which one will be shownhavent seen that one, bootstrap fluidimage has been my go too, ill take a look thanks c: