Client side optimization


    As per yahoo! optimization guidelines for making Zenphoto faster at client-side, here are some hacks.

    FIRST: Edit .htaccsss file and add the following lines.

    <ifmodule mod_expires.c><filesmatch "\.(jpg|gif|png|css|js)$">
    ExpiresActive on
    ExpiresDefault "access plus 1 year"
    </ifmodule>FileETag None
    That will make your image, javascript,css files cache lifetime 1 year+ and Removes Etags, If Apache WebServer?has attached any. So that webpage header size can be reduced.

    SECOND: If your web server is supporting gzip compression, edit index.php and add following line at Top of the page.

    header("Vary: Accept-Encoding");if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
    else ob_start();

    So, Web server will deliver entire webpage as gzip compression format to the browser. So, network bandwidth can be reduced.

    THIRD: Convert your all JavaScript, CSS files into PHP code (Make simple echo statement) and follow SECOND step for them. Finally, load them in templates. That will make your JavaScript, css gzip-compressed & faster deliverable.

    if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'],
    else ob_start();
    header("content-type: application/x-javascript; charset: UTF-8");
    $gd = "Expires: Monday, January 18, 2038 12:44:06 AM";
    <?phpif (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
    else ob_start();
    header("Content-type: text/css; charset: UTF-8");
    $gd = "Expires: Sun, 1 Jan 2017 05:00:00 GMT";


    <link rel="stylesheet" href="/themes/sterile/zen.css.php"></link>

    try to put javascript before </body>

    <script src="/themes/sterile/SampleJavaScript.js.php"></script>

    So, The loading of web-page won't blocked untill javascript is loaded.

    You can check the performance of the site and test It with Firefox firebug-Yslow plug-in.

    This extension has been abandoned by the ZenphotoCMS team and we provide it for archival purposes on our "unsuppported-plugins-offical" GitHub repository "as is". .

    Info & download (GitHub)

    For questions and comments please use the forum or discuss on the social networks.

    More by author:

    • Nothing else available by Vikaskbh

    Related items