How would you optimize a website's assets/resources?

  1. Image of Proper Size: Always using image of proper size and specifying height and width of image is good idea.
  2. Compressing image, Use Photo shop, Save for Web
  3. Use of Sprites
  4. 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');
  5. 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.