Showing posts from July, 2015

[SOLVED] Issue - Image faded view, only in browser

In some cases, the images will appear properly in "image viewer" software, but in browser it will appear with the faded effect.
For Ex:
The Pic1 shows the same image file with different appearance in browser and the image viewer software.

The image file's meta data missed the color Profile. So, the PC will automatically apply the sRGB profile. But, the browser can not apply the color profile by default (Except Internet Explorer).

We've to embed the color profile to the file.

It is possible by ImageMagick shell script.

Step #1:
Download the expected color profile from the link.

Step #2:
Save the color profile in your system (Ex.: /opt/tmp/sRGB_v4_ICC_preference_displayclass.icc)

Step #3:
Execute the following shell command in the terminal

convert <filename> -profile /opt/tmp/sRGB_v4_ICC_preference_displayclass.icc <destination>
For example
convert /opt/tmp/umbrella.jpg -profile /opt/tmp/sRGB_v4_ICC_preference_displayclass.icc /opt/tmp…

HTML page to PDF conversion - Codeigniter library

Step #1 Download the library from the URL

Step #2 Unzip the master

Step #3 There will be three folders

a) controllers
b) libraries
c) third_party

copy all these folders to <your application path>/application/ folder

Step #4 Create a view file and name it "welcome_message" and type some HTML content there

Step #5 There will be the sample controller. Access the controller by
http://localhost/<your project name>/demopdf_test

Step #6 Now the pdf file will be downloaded


HTML Table to Excel file - Export

The following code will convert the HTML Table to Excel file

<table id="headerTable">

<button id="btnExport" onclick="tableToExcel('headerTable');"> EXPORT </button>
<iframe id="txtArea1" style="display:none"></iframe> <!-- THIS IFRAME IS REQUIRED -->
function tableToExcel(tblId)
    var tab_text="<table border='2px'><tr bgcolor='#87AFC6'>";
    var textRange; var j=0;
    tab = document.getElementById(tblId); // id of table

    for(j = 0 ; j < tab.rows.length ; j++)