Hello everybody,
What is the difference between Asset::img() and Html::img() ?
And if there are no difference, why we have 2 ways to do the same thing.
Html::img() just generates the <img> tag, with as source whatever you pass as parameter.
Asset::img() expects a base name (like 'icons/google.png') which the Asset class will convert to the source for the <img> tag based on it's configuration.
So the first one is hard-coded (like hard coding your HTML yourself), the second one is dynamic, and allows you to switch asset locations (the Theme class uses this mechanism to switch assets when you switch themes), or to switch from local files to static files (other subdomain) or a CDN, without changing your application code.