Kickback-Kingdom / kickback-kingdom-website

This repository houses the code for the Kickback Kingdom website.
1 stars 3 forks source link

Replace hard-coded image asset paths with configuration that's accessed through method calls. #4

Open chadjoan opened 8 months ago

chadjoan commented 8 months ago

So, wherever the PHP code has something like "assets/media/icons/foo.jpg", we should replace it with something like Icons::path_("foo","jpg").

The method call is important, and I think the above is superior to the (probably more obvious) solution of Icons::PATH . "foo.jpg", because it allows the Icons::path_ method to intercept all of the image references (and thus give us introspective opportunities). This may also be important for dynamically switching between locally-referenced resources (relative paths) and externally-referenced resources (make the client/browser load them from a different domain).

Because this change would involve externalizing asset paths into a configuration file, this issue then depends on issue #3: Introduce a new config file for various non-security settings.

Notably, this commit is a separate concern from dynamically stored asset paths, like what is done for user-uploaded image content. That will probably have some sort of "root path" configuration too, but we really should keep those separated from the static assets that are ALWAYS present on the webpage.