background bug

Welcome Forums PavillionWP background bug

This topic contains 1 reply, has 2 voices, and was last updated by  Brankic1979 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6899

    huhh2
    Participant

    If I post a single column with a png image as a background, the function imagecreatefromjpeg (called on line 1158 in functions.php) crashes, because the input is not jpeg. Which makes sense, I’m just not sure why this function is being called. The image actually renders fine. Just so you know!


      Quote
    • This topic was modified 2 months ago by  huhh2.
    #6903

    Brankic1979
    Keymaster

    Thank you very much for noticing this (I totally forgot about other image types besides jpg).

    We’re using this function to get brightness of the image, so in some layouts the script can choose light or dark color for the title which is in front of that image.

    To fix this crash, replace

    
    $img = imagecreatefromjpeg($filename);
    

    with

    
    			if (exif_imagetype($filename) == IMAGETYPE_JPEG) $img = imagecreatefromjpeg($filename);
    			else if (exif_imagetype($filename) == IMAGETYPE_PNG) $img = imagecreatefrompng($filename);
    			else if (exif_imagetype($filename) == IMAGETYPE_GIF) $img = imagecreatefromgif($filename);
    

      Quote
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.