Search code examples
phpjquerycharacter-encodinggdlightbox

Lightbox displays garbage characters instead of image


I have installed a lightbox script in my website. When lightbox pops up, but there are garbage characters displaying instead of the large version of the image:

����JFIF��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ��C     ��C    ����"�� ���}!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������

What is this? It looks like it's relevant to the image file but I don't understand what causes this issue... Any suggestions?

Edit: Here's the whole code of the image.


Solution

  • in the php file where you are creating the image dynamically using GD liabrary write following code.

    header("content-type:image/jpg");
    

    OR if it is a png image then

    header("content-type:image/png");
    

    From the code it seems to be a jpg file. But you should know the format.

    Basically it is problem in php file rather than the lightbox.