How would you optimize a website's assets/resources?
- Image of Proper Size: Always using image of proper size and specifying height and width of image is good idea.
- Compressing image, Use Photo shop, Save for Web
- Use of Sprites
- Caching:
$expire
= 60 * 60 * 24 * 1;
// seconds, minutes, hours, days
header(
'Cache-Control: maxage='
.
$expire
);
header(
'Expires: '
.
gmdate
(
'D, d M Y H:i:s'
, time() +
$expire
).
' GMT'
);
header(
'Last-Modified: '
.
gmdate
(
'D, d M Y H:i:s'
).
' GMT'
);
- Data URI Scheme / Inline Images
$picture
=
fread
(
$fp
,
filesize
(
$file
));
fclose(
$fp
);
// base64 encode the binary data, then break it
// into chunks according to RFC 2045 semantics
$base64
=
base64_encode
(
$picture
);
$tag
=
'<img src="data:image/jpg;base64,'
.
$base64
.
'" alt="" />'
;
$css
=
'url(data:image/jpg;base64,'
.
str_replace
(
"\n"
,
""
,
$base64
).
'); '
;
0 comments:
Feel free to contact the admin for any suggestions and help.