WordPress.org

Forums

Link Library
Type of favicon files is faulty (1 post)

  1. Brummbaer
    Member
    Posted 2 years ago #

    Hello, if you press "Generate Favorite Icons and Store locally" it save for thumbs and favicons allways .JPG files. But favicons are native .PNG files.
    I have make a change to your code to solve this problem.

    Change code:

    $img = $uploads['basedir'] . "/" . $filepath. "/" . $linkid . ".jpg";
    $status = file_put_contents($img, file_get_contents($genthumburl));
    
    if ($status !== false)
    {
    $newimagedata = array("link_id" => $linkid, "link_image" => $uploads['baseurl'] . "/" . $filepath . "/" . $linkid . ".jpg");

    Replace with following code (or a better solution):

    if ($mode == 'thumb')
    {
    $img = $uploads['basedir'] . "/" . $filepath. "/" . $linkid . ".jpg";
    }
    else
    {
    $img = $uploads['basedir'] . "/" . $filepath. "/" . $linkid . ".png";
    }
    
    $status = file_put_contents($img, file_get_contents($genthumburl));
    
    if ($status !== false)
    {
    
    if ($mode == 'thumb')
    {
    $newimagedata = array("link_id" => $linkid, "link_image" => $uploads['baseurl'] . "/" . $filepath . "/" . $linkid . ".jpg");
    }
    else
    {
    $newimagedata = array("link_id" => $linkid, "link_image" => $uploads['baseurl'] . "/" . $filepath . "/" . $linkid . ".png");
    }

    Thanks for your great work.

    http://wordpress.org/extend/plugins/link-library/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic