Is it best to store each version name in it’s own database field? image, image475, image768 and so on?
Or a better way I was thinking (which is similar perhaps to Wordpress) is to dynamically write on page what numbers we want.
So :
Code: Select all
<img srcset="/images/pages/$row->image”.475.”.jpg 475w,
/images/pages/$row->image”.768.”jpg 768w,
/images/pages/$row->image”.475.”.jpg 1920w"
sizes="(max-width: 475px) 475px,
(max-width: 768px) 768px,
(max-width: 1920px) 1920px"
src="/images/pages/25644881item-phone-name.jpg" alt='photo name here'>
$row->image”.475.”
So we take $row->image, split up the name and extension into two variables. So it reads a little more like this:
Code: Select all
<img srcset="/images/pages/$imagename"."475"."$imageextension"." 475w,....