Added the possibility to either convert favicons to PNG or leave them in ICO format. New favicon.php and install.php
This commit is contained in:
34
favicon.php
34
favicon.php
@@ -4,19 +4,24 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
|
||||
}
|
||||
|
||||
class favicon {
|
||||
function favicon ($url) {
|
||||
global $settings;
|
||||
if ($settings['show_bookmark_icon']) {
|
||||
if ($this->parsed_url = $this->return_parse_url ($url)) {
|
||||
if ($this->favicon_url = $this->get_favicon_url ()) {
|
||||
$this->icon_name = rand () . basename ($this->favicon_url);
|
||||
if ($this->get_favicon_image ()) {
|
||||
$this->convert_favicon ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function favicon ($url) {
|
||||
global $settings, $convert_favicons;
|
||||
if ($settings['show_bookmark_icon']) {
|
||||
if ($this->parsed_url = $this->return_parse_url ($url)) {
|
||||
if ($this->favicon_url = $this->get_favicon_url ()) {
|
||||
$this->icon_name = rand () . basename ($this->favicon_url);
|
||||
if ($this->get_favicon_image ()) {
|
||||
if ($convert_favicons) {
|
||||
$this->favicon = $this->convert_favicon ();
|
||||
}
|
||||
else {
|
||||
$this->favicon = "./favicons/" . $this->icon_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
###
|
||||
### check the image type and convert & resize it if required
|
||||
### returns the absolute path of the (converted) .png file
|
||||
@@ -38,9 +43,8 @@ class favicon {
|
||||
|
||||
# convert image in any case to 16x16 and .png
|
||||
system ("$convert $file_to_convert -resize 16x16 $tmp_file.png");
|
||||
$this->favicon = $tmp_file . ".png";
|
||||
@unlink ($tmp_file);
|
||||
return true;
|
||||
return $tmp_file . ".png";
|
||||
}
|
||||
else {
|
||||
@unlink ($tmp_file);
|
||||
|
||||
Reference in New Issue
Block a user