added script to generate fancy bookmark lists
This commit is contained in:
parent
57e32beb74
commit
d6958bbdc7
3 changed files with 530 additions and 0 deletions
100
bookmarks/bookmarks.csv
Normal file
100
bookmarks/bookmarks.csv
Normal file
|
@ -0,0 +1,100 @@
|
|||
200;http://www.steffenvogel.de/;;Steffens Noteblog
|
||||
101;http://www.google.de/;http://www.google.com/favicon.ico;Google
|
||||
100;http://www.facebook.com/;http://www.facebook.com/favicon.ico;Facebook
|
||||
97;http://www.heise.de/;http://www.heise.de/favicon.ico;heise online
|
||||
94;http://www.gulli.com/;http://static.gulli.com/layout/icons/gullicon.png;gulli.com
|
||||
90;http://www.youtube.com/;http://s.ytimg.com/yt/favicon-vfl122048.ico;YouTube
|
||||
89;http://www.last.fm/;http://cdn.last.fm/flatness/favicon.2.ico;Last.fm
|
||||
89;http://www.adafruit.com/;http://adafruit.com/favicon.ico;Adafruit Industries, Unique & fun DIY electronics and kits
|
||||
88;http://www.golem.de/;http://www.golem.de/favicon.ico;Golem.de: IT-News für Profis
|
||||
83;http://www.kino.to/;http://kino.to/favicon.ico;Kino.to Stream Seite - Serien und Moviestream www.kino.to
|
||||
83;http://www.vimeo.com/;http://vimeo.com/favicon.ico;Vimeo, Video Sharing For You
|
||||
80;http://www.hackaday.com/;http://s3.wordpress.com/wp-content/themes/vip/hackadaycom/favicon.ico;Hack a Day
|
||||
77;http://www.bahn.de/;http://www.bahn.de/favicon.ico;bahn.de - Ihr Mobilitätsportal für Reisen, Bahn, Urlaub, Hotels, Städtereisen und Mietwagen
|
||||
75;http://de.wikipedia.org/;http://de.wikipedia.org/favicon.ico;Wikipedia . Die freie Enzyklopädie
|
||||
73;http://localhost/;;"Mein eigener Rechner ;-)"
|
||||
72;http://www.php.net/;http://static.php.net/www.php.net/favicon.ico;PHP: Hypertext Preprocessor
|
||||
70;http://www.ubuntuusers.de/;http://static.ubuntuusers.de/img/favicon.ico;ubuntuusers.de
|
||||
69;http://www.mitfahrgelegenheit.de/;http://www.mitfahrgelegenheit.de/favicon.ico;Mitfahrzentrale Deutschland
|
||||
66;http://www.openstreetmap.org/;http://www.openstreetmap.org/favicon.ico;OpenStreetMap
|
||||
66;http://www.handball.griesm.de/;http://handball.griesm.de/images/favicon.ico;TuS Griesheim Handball - Willkommen bei den Handballern!
|
||||
61;http://www.doodle.com/;http://doodle.com/graphics/doodle.ico;Doodle: easy scheduling
|
||||
59;http://www.wikimedia.org/;http://wikimediafoundation.org/favicon.ico;Wikimedia Foundation
|
||||
57;http://www.deviantart.com/;http://st.deviantart.net/icons/favicon.ico;deviantART: where ART meets application!
|
||||
56;http://de.indymedia.org/;http://de.indymedia.org/favicon.ico;Indymedia - Alternative Medien
|
||||
55;http://www.thepiratebay.org/;http://thepiratebay.org/favicon.ico;The Pirate Bay
|
||||
55;http://www.ccc.de/;http://www.ccc.de/favicon.ico;Chaos Computer Club
|
||||
50;http://dict.leo.org/;http://dict.leo.org/favicon_en.ico;LEO Deutsch-Englisches Wörterbuch
|
||||
49;http://www.oreilly.de/;http://www.oreilly.de/favicon.ico;O'Reilly Verlag
|
||||
47;http://www.reichelt.de/;http://www.reichelt.de/favicon.ico;reichelt elektronik - OnlineShop
|
||||
44;http://www.geocaching.com/;http://www.geocaching.com/favicon.ico;Geocaching - The Official Global GPS Cache Hunt Site
|
||||
44;http://www.wired.com/;http://www.wired.com/favicon.ico;Wired News
|
||||
44;http://www.rockbox.org/;http://www.rockbox.org/favicon.ico;Rockbox - Open Source Jukebox Firmware
|
||||
44;http://www.hakiri.org/;http://www.hakiri.org/favicon.ico;Hakiri | Hacker Lifestyle
|
||||
44;http://www.twitter.com/;http://a1.twimg.com/a/1257465343/images/favicon.ico;Twitter
|
||||
43;http://www.arduino.cc/;;Arduino
|
||||
33;http://www.rapidshare.com/;http://rapidshare.com/img2/favicon.ico;RapidShare: 1-CLICK Web hosting - Easy Filehosting
|
||||
32;http://www.wikileaks.org/;http://wikileaks.org/favicon.ico;Wikileaks - Wikileaks
|
||||
30;http://java.sun.com/;http://java.sun.com/favicon.ico;Developer Resources for Java Technology
|
||||
29;http://www.ebay.de/;http://www.ebay.de/favicon.ico;eBay
|
||||
27;http://www.flickr.com/;http://www.flickr.com/favicon.ico;Willkommen bei Flickr - Fotosharing
|
||||
25;http://www.maemo.org/;http://static.maemo.org/style_maemo2009/maemo_favicon.ico;maemo.org - maemo.org: Home of the Maemo community
|
||||
24;http://www.paypal.de/;http://www.paypalobjects.com/WEBSCR-600-20091026-1/en_US/i/icon/pp_favicon_x.ico;Willkommen - PayPal
|
||||
23;http://www.koelncampus.com/;http://www.koelncampus.com/favicon.ico;Kölncampus - Home
|
||||
22;http://www.studivz.net/;http://static.pe.studivz.net/20091106-1/favicon.ico;studiVZ | Bist Du schon drin?
|
||||
22;http://www.milw0rm.com/;http://www.milw0rm.com/favicon.ico;milw0rm - exploits : vulnerabilities : videos : papers : shellcode
|
||||
20;http://www.inkscape.org/;http://www.inkscape.org/favicon.ico;Inkscape. Draw Freely.
|
||||
20;http://www.kde.org/;http://kde.org/media/images/favicon.ico;KDE - Be free
|
||||
20;http://www.pidgin.im/;http://pidgin.im/shared/img/favicon.png;Pidgin, the universal chat client
|
||||
20;http://www.wordpress.org/;http://s.wordpress.org/favicon.ico?3;WordPress . Blog Tool and Publishing Platform
|
||||
20;http://www.gimp.org/;http://www.gimp.org/images/wilber16.png;GIMP - The GNU Image Manipulation Program
|
||||
20;http://www.gnome.org/;http://www.gnome.org/img/logo/foot-16.png;GNOME: The Free Software Desktop Project
|
||||
20;http://www.videolan.org/;http://www.videolan.org/images/icons/favicon.ico;VideoLAN, Free streaming and multimedia solutions for all OS!
|
||||
20;http://www.skype.com/;http://c.skype.com/i/images/icons/favicon.ico;Skype . kostenlose Internetanrufe und preiswerte Telefonanrufe
|
||||
20;http://www.mozilla.org/;http://www.mozilla.org/favicon.ico;Mozilla Project
|
||||
20;http://www.wireshark.org/;http://www.wireshark.org/favicon.ico;Wireshark · Go deep.
|
||||
17;http://www.icq.de/;http://www.icq.de/favicon.ico;ICQ.com - community, people search and messaging service!
|
||||
13;http://www.indiepedia.de/;http://indiepedia.de/favicon.ico;indiepedia.de
|
||||
10;http://www.michaschwab.de/;;Micha's Blog
|
||||
10;http://www.nadeo.com/;http://nadeo.com/favicon.ico;nadeo
|
||||
10;http://www.robertnitsch.de/;http://www.robertnitsch.de/Pics/philiosoph.png;PhiLIOsoph
|
||||
10;http://www.cfranke.com/;;Christian Franke - cfranke.com - Moderator & Designer
|
||||
5;http://www.houseofhackers.ning.com/;http://houseofhackers.ning.com/favicon.ico;House of Hackers
|
||||
1;http://www.katalyse.de/;http://www.katalyse.de/sites/all/themes/katalyse/favicon.ico;KATALYSE Institut für angewandte Umweltforschung e.V.
|
||||
;http://www.sourceforge.net/;http://a.fsdn.com/con/img/favicon.ico;SourceForge.net: Find and Develop Open Source Software
|
||||
;http://www.apache.org/;http://apache.org/favicon.ico;Welcome! - The Apache Software Foundation
|
||||
;http://www.atmel.com/;http://atmel.com/Atmel/img/favicon.ico;Atmel Corporation
|
||||
;http://de.creativecommons.org/;http://de.creativecommons.org/favicon.ico;Creative Commons Deutschland
|
||||
;http://de.openoffice.org/;http://de.openoffice.org/branding/images/favicon.ico;de: OpenOffice.org
|
||||
;http://de.selfhtml.org/;http://de.selfhtml.org/src/favicon.ico;SELFHTML 8.1.2
|
||||
;http://www.denic.de/;http://denic.de/fileadmin/_t3t/res/favicon.ico;Home: www.denic.de
|
||||
;http://www.eclipse.org/;http://eclipse.org/favicon.ico;Eclipse.org
|
||||
;http://www.freshmeat.net/;http://freshmeat.net/favicon.ico;Welcome to freshmeat.net
|
||||
;http://www.imdb.de/;http://i.imdb.com/favicon.ico;The Internet Movie Database (IMDb)
|
||||
;http://www.zeit.de/index;http://images.zeit.de/static/img/favicon.ico;ZEIT ONLINE | Nachrichten, Hintergründe und Debatten
|
||||
;http://www.tinyurl.com/;http://tinyurl.com/favicon.ico;TinyURL.com - shorten that long URL into a tiny URL
|
||||
;http://www.3sat.de/;http://www.3sat.de/dynamic/sitegen/gfx/favicon.gif;3sat.online
|
||||
;http://www.amazon.de/;http://www.amazon.de/favicon.ico;Amazon.de
|
||||
;http://www.apple.com/;http://www.apple.com/favicon.ico;Apple
|
||||
;http://www.archive.org/;http://www.archive.org/favicon.ico;Internet Archive
|
||||
;http://www.cnn.com/;http://www.cnn.com/favicon.ico;CNN.com - Breaking News, U.S., World, Weather, Entertainment & Video News
|
||||
;http://www.das-labor.org/;http://www.das-labor.org/favicon.ico;Das Labor - Bochum
|
||||
;http://www.debian.org/;http://www.debian.org/favicon.ico;Debian -- Das universelle Betriebssystem
|
||||
;http://www.elektrischer-reporter.de/;http://www.elektrischer-reporter.de/favicon.ico;Elektrischer Reporter - Phase II
|
||||
;http://www.foebud.org/;http://www.foebud.org/favicon.ico;Willkommen beim FoeBuD e.V. . FoeBuD e.V.
|
||||
;http://www.lio-darmstadt.de/;http://www.lio-darmstadt.de/fileadmin/templates/ver20/img/favicon/favicon_lio.ico;Die LIO
|
||||
;http://www.myspace.com/;http://www.myspace.com/favicon.ico;MySpace - Meine Freunde
|
||||
;http://www.neon.de/;http://www.neon.de/favicon.ico;NEON.de
|
||||
;http://www.spiegel.de/;http://www.spiegel.de/favicon.ico;SPIEGEL ONLINE - Nachrichten
|
||||
;http://www.stadtrevue.de/;http://www.stadtrevue.de/favicon.ico;StadtRevue Köln Magazin | Tagestipps
|
||||
;http://www.stern.de/;http://www.stern.de/favicon.ico;Nachrichten - Aktuelle News, Hintergründe und bildstarke Reportagen | STERN.DE
|
||||
;http://www.tu-darmstadt.de/;http://www.tu-darmstadt.de/media/corporate_design/cd_grafiken/athene_favicon.png;Home . Technische Universität Darmstadt
|
||||
;http://www.ubuntu.com/;http://www.ubuntu.com/sites/all/themes/ubuntu09/favicon.ico;Ubuntu
|
||||
;http://www.welt.de/;http://www.welt.de/favicon.ico;Nachrichten und aktuelle Informationen aus Politik, Wirtschaft, Sport und Kultur - WELT ONLINE
|
||||
;http://www.wetter.com/;http://www.wetter.com/favicon.ico;wetter.com: Wetter, Wettervorhersage, Wetterbericht, Reise
|
||||
;http://www.tvtoday.de/;http://www.tvtoday.de/favicon.ico;Fernsehprogramm von TV Today, Wissen was heute im TV Programm läuft - TV Today
|
||||
;http://www.gutenberg.org/;http://www.gutenberg.org/favicon.ico;Gutenberg
|
||||
;http://www.kvb-koeln.de/;http://www.kvb-koeln.de/favicon.ico;Kölner Verkehrs-Betriebe AG
|
||||
;http://www.cinedom.de/;;CINEDOM
|
||||
;http://www.deutschepost.de/;http://www.deutschepost.de/favicon.ico;Deutsche Post
|
||||
;http://www.alternate.de/;http://www.alternate.de/favicon.ico;ALTERNATE. Hardware - Software - Entertainment
|
|
417
bookmarks/favico.php
Normal file
417
bookmarks/favico.php
Normal file
|
@ -0,0 +1,417 @@
|
|||
<?php
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Favicon Class (work with favicons), ver. 1.0, June, 2006.
|
||||
#
|
||||
# (c) 2006 ControlStyle Company. All rights reserved.
|
||||
# Developped by Nikolay I. Yarovoy, Dmitry V. Domojilov.
|
||||
#
|
||||
# http://www.controlstyle.com
|
||||
# info@controlstyle.com
|
||||
#
|
||||
################################################################################
|
||||
|
||||
class favicon
|
||||
{
|
||||
var $ver = '1.1';
|
||||
var $site_url = ''; # url of site
|
||||
var $if_modified_since = 0; # cache
|
||||
var $is_not_modified = false;
|
||||
var $ico_type = 'ico'; # ico, gif or png only
|
||||
var $ico_url = ''; # full uri to favicon
|
||||
var $ico_exists = 'not checked'; # no comments
|
||||
var $ico_data = ''; # ico binary data
|
||||
var $output_data = ''; # output image binary data
|
||||
|
||||
# main proc
|
||||
function favicon($site_url, $if_modified_since = 0)
|
||||
{
|
||||
$site_url = trim(str_replace('http://', '', trim($site_url)), '/');
|
||||
$site_url = explode('/', $site_url);
|
||||
$site_url = 'http://' . $site_url[0] . '/';
|
||||
$this->site_url = $site_url;
|
||||
$this->if_modified_since = $if_modified_since;
|
||||
$this->get_ico_url();
|
||||
$this->is_ico_exists();
|
||||
$this->get_ico_data();
|
||||
}
|
||||
|
||||
# get uri of favicon
|
||||
function get_ico_url()
|
||||
{
|
||||
if ($this->ico_url == '')
|
||||
{
|
||||
$this->ico_url = $this->site_url . 'favicon.ico';
|
||||
|
||||
# get html of page
|
||||
$h = @fopen($this->site_url, 'r');
|
||||
if ($h)
|
||||
{
|
||||
$html = '';
|
||||
while (!feof($h) and !preg_match('/<([s]*)body([^>]*)>/i', $html))
|
||||
{
|
||||
$html .= fread($h, 200);
|
||||
}
|
||||
fclose($h);
|
||||
|
||||
# search need <link> tag
|
||||
if (preg_match('/<([^>]*)link([^>]*)(rel="icon"|rel="shortcut icon")([^>]*)>/iU', $html, $out))
|
||||
{
|
||||
|
||||
$link_tag = $out[0];
|
||||
if (preg_match('/href([s]*)=([s]*)"([^"]*)"/iU', $link_tag, $out))
|
||||
{
|
||||
$this->ico_type = (!(strpos($link_tag, 'png')===false)) ? 'png' : 'ico';
|
||||
$ico_href = trim($out[3]);
|
||||
if (strpos($ico_href, 'http://')===false)
|
||||
{
|
||||
$ico_href = rtrim($this->site_url, '/') . '/' . ltrim($ico_href, '/');
|
||||
}
|
||||
$this->ico_url = $ico_href;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->ico_url;
|
||||
}
|
||||
|
||||
# check that favicon is exists
|
||||
function is_ico_exists()
|
||||
{
|
||||
if ($this->ico_exists=='not checked')
|
||||
{
|
||||
$h = @fopen($this->ico_url, 'r');
|
||||
$this->ico_exists = ($h) ? true : false;
|
||||
if ($h) fclose($h);
|
||||
}
|
||||
return $this->ico_exists;
|
||||
}
|
||||
|
||||
# get ico data
|
||||
function get_ico_data()
|
||||
{
|
||||
if ($this->ico_data=='' && $this->ico_url!='' && $this->ico_exists && !$this->is_not_modified)
|
||||
{
|
||||
# get ico data
|
||||
$ico_z = parse_url($this->ico_url);
|
||||
$ico_path = $ico_z['path'];
|
||||
$ico_host = $ico_z['host'];
|
||||
$ico_ims = gmdate('D, d M Y H:i:s', $this->if_modified_since) . ' GMT';
|
||||
|
||||
$fp = @fsockopen($ico_host, 80);
|
||||
if ($fp)
|
||||
{
|
||||
$out = "GET {$ico_path} HTTP/1.1\r\n";
|
||||
$out .= "Host: {$ico_host}\r\n";
|
||||
$out .= "User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3\r\n";
|
||||
$out .= "If-Modified-Since: {$ico_ims}\r\n";
|
||||
$out .= "Connection: Close\r\n\r\n";
|
||||
fwrite($fp, $out);
|
||||
$data = '';
|
||||
while (!feof($fp)) $data .= fgets($fp, 128);
|
||||
fclose($fp);
|
||||
$response = substr($data, 0, 15);
|
||||
$this->is_not_modified = !(strpos($response, '304')===false);
|
||||
if ($this->is_not_modified)
|
||||
{
|
||||
$this->ico_data = 'not modified';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = explode("\r\n\r\n", $data);
|
||||
if (count($data)>0)
|
||||
{
|
||||
unset($data[0]);
|
||||
$this->ico_data = implode("\r\n\r\n", $data);
|
||||
}
|
||||
}
|
||||
$this->output_data = '';
|
||||
}
|
||||
}
|
||||
return $this->ico_data;
|
||||
}
|
||||
|
||||
# get output data
|
||||
function get_output_data()
|
||||
{
|
||||
if ($this->output_data=='')
|
||||
{
|
||||
if ($this->ico_data=='not modified')
|
||||
{
|
||||
# icon is not modified since defined time
|
||||
$this->output_data = 'not modified';
|
||||
}
|
||||
elseif($this->ico_data=='')
|
||||
{
|
||||
# error(s) in getting icon data
|
||||
$this->output_data = $this->empty_png();
|
||||
}
|
||||
else
|
||||
{
|
||||
# convert ico to png, gif & return
|
||||
if (substr($this->ico_data, 0, 3)==='GIF') $this->ico_type = 'gif';
|
||||
$this->output_data = $this->ico_data;
|
||||
if ($this->ico_type==='ico')
|
||||
{
|
||||
$this->output_data = $this->ico2png($this->output_data);
|
||||
}
|
||||
if ($this->ico_type==='gif')
|
||||
{
|
||||
$this->output_data = $this->gif2png($this->output_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->output_data;
|
||||
}
|
||||
|
||||
# if error or icon is not found we output empty png image
|
||||
function empty_png()
|
||||
{
|
||||
$res = '';
|
||||
$im = imagecreatetruecolor(16, 16);
|
||||
$color = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefill($im, 1, 1, $color);
|
||||
|
||||
# output png
|
||||
ob_start();
|
||||
|
||||
# imagesavealpha($im, true);
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
$res = ob_get_clean();
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Convert gif to png function,
|
||||
# support gif-functions by GD is needed
|
||||
function gif2png($gif)
|
||||
{
|
||||
$im2 = imagecreatefromstring($gif);
|
||||
|
||||
# background alpha is disabled because IE 5.5 + have bug with alpha-channels
|
||||
# by default background color is white
|
||||
# imagealphablending($im, false);
|
||||
# imagefilledrectangle($im, 0, 0, 16, 16, $color);
|
||||
# imagealphablending($im, true);
|
||||
$im = imagecreatetruecolor(16, 16);
|
||||
$color = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefill($im, 1, 1, $color);
|
||||
imagecopy($im, $im2, 0, 0, 0, 0, 16, 16);
|
||||
|
||||
# output png
|
||||
ob_start();
|
||||
# imagesavealpha($im, true);
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
imagedestroy($im2);
|
||||
$res = ob_get_clean();
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Convert ico to png function,
|
||||
# information about ico format is accessible on a site http://kainsk.tomsk.ru/g2003/sys26/oswin.htm,
|
||||
function ico2png($ico)
|
||||
{
|
||||
$res = '';
|
||||
|
||||
while(!isset($tmp))
|
||||
{
|
||||
$tmp = '';
|
||||
|
||||
# get ICONDIR struct & check that it is correct ico format
|
||||
$icondir = unpack('sidReserved/sidType/sidCount', substr($ico, 0, 6));
|
||||
if ($icondir['idReserved']!=0 || $icondir['idType']!=1 || $icondir['idCount']<1) break;
|
||||
$icondir['idEntries'] = array();
|
||||
$entry = array();
|
||||
for($i=0; $i<$icondir['idCount']; $i++)
|
||||
{
|
||||
$entry = unpack('CbWidth/CbHeight/CbColorCount/CbReserved/swPlanes/swBitCount/LdwBytesInRes/LdwImageOffset', substr($ico, 6 + $i*16, 16));
|
||||
$icondir['idEntries'][] = $entry;
|
||||
}
|
||||
|
||||
# select need icon & get it raw data
|
||||
$iconres = '';
|
||||
$bpx = 1; # bits per pixel
|
||||
$idx = 0; # index of need icon
|
||||
foreach($icondir['idEntries'] as $k=>$entry)
|
||||
{
|
||||
if ($entry['bWidth']==16 && isset($entry['swBitCount']) && $entry['swBitCount']>$bpx && $entry['swBitCount']<33)
|
||||
{
|
||||
$idx = $k;
|
||||
$bpx = $entry['swBitCount'];
|
||||
}
|
||||
}
|
||||
$iconres = substr($ico, $icondir['idEntries'][$idx]['dwImageOffset'], $icondir['idEntries'][$idx]['dwBytesInRes']);
|
||||
unset($ico);
|
||||
unset($icondir);
|
||||
|
||||
# getting bitmap info
|
||||
$bitmap_info = array();
|
||||
$bitmap_info['header'] = unpack('LbiSize/LbiWidth/LbiHeight/SbiPlanes/SbiBitCount/LbiCompression/LbiSizeImage/LbiXPelsPerMeter/LbiYPelsPerMeter/LbiClrUsed/LbiClrImportant',
|
||||
substr($iconres, 0, 40));
|
||||
|
||||
$bitmap_info['header']['biHeight'] = $bitmap_info['header']['biHeight'] / 2;
|
||||
$number_color = 0;
|
||||
|
||||
if ($bitmap_info['header']['biBitCount'] > 16)
|
||||
{
|
||||
$number_color = 0;
|
||||
$sizecolor = $bitmap_info['header']['biWidth']*$bitmap_info['header']['biBitCount'] * $bitmap_info['header']['biHeight'] / 8;
|
||||
}
|
||||
elseif ( $bitmap_info['header']['biBitCount'] < 16)
|
||||
{
|
||||
$number_color = (int) pow(2, $bitmap_info['header']['biBitCount']);
|
||||
$sizecolor = $bitmap_info['header']['biWidth']*$bitmap_info['header']['biBitCount'] * $bitmap_info['header']['biHeight'] / 8;
|
||||
if ($bitmap_info['header']['biBitCount']=='1') $sizecolor = $sizecolor * 2;
|
||||
}
|
||||
else return $res;
|
||||
|
||||
$rgb_table_size = 4 * $number_color;
|
||||
for($i=0; $i<$number_color; $i++)
|
||||
{
|
||||
$bitmap_info['colors'][] = unpack('CrgbBlue/CrgbGreen/CrgbRed/CrgbReserved', substr($iconres, 40 + $i*4, 4));
|
||||
}
|
||||
$current_offset = 40 + $number_color * 4;
|
||||
|
||||
$arraycolor = array();
|
||||
|
||||
for($i=0; $i<$sizecolor; $i++)
|
||||
{
|
||||
$value = unpack('Cvalue', substr($iconres, $current_offset, 1));
|
||||
$arraycolor[] = $value['value'];
|
||||
$current_offset++;
|
||||
}
|
||||
|
||||
# background alpha is disabled because IE 5.5 + have bug with alpha-channels
|
||||
# by default background color is white
|
||||
# imagealphablending($im, false);
|
||||
# imagefilledrectangle($im, 0, 0, 16, 16, $color);
|
||||
# imagealphablending($im, true);
|
||||
$im = imagecreatetruecolor(16, 16);
|
||||
$color = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefill($im, 1, 1, $color);
|
||||
|
||||
# getting mask
|
||||
$alpha = '';
|
||||
for($i=0; $i<16; $i++)
|
||||
{
|
||||
$z = unpack('Cx/Cy', substr($iconres, $current_offset, 2));
|
||||
$z = str_pad(decbin($z['x']), 8, '0', STR_PAD_RIGHT) . str_pad(decbin($z['y']), 8, '0', STR_PAD_LEFT);
|
||||
$alpha .= $z;
|
||||
$current_offset = $current_offset + 4;
|
||||
}
|
||||
|
||||
# drawing image
|
||||
$ico_size = 16;
|
||||
$off = 0; # range (0-255)
|
||||
|
||||
# cases for different color depth
|
||||
switch ($bitmap_info['header']['biBitCount'])
|
||||
{
|
||||
|
||||
###################### for 32 bit icons ######################
|
||||
case 32:
|
||||
for($y=0; $y<$ico_size; $y++)
|
||||
{
|
||||
for($x=0; $x<$ico_size; $x++)
|
||||
{
|
||||
$a = round((255-$arraycolor[$off*4+3])/2);
|
||||
$a = ($a<0) ? 0 : $a;
|
||||
$a = ($a>127) ? 127 : $a;
|
||||
$color = imagecolorallocatealpha($im, $arraycolor[$off*4+2], $arraycolor[$off*4+1], $arraycolor[$off*4], $a);
|
||||
imagesetpixel($im, $x, $ico_size-1-$y, $color);
|
||||
$off++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
###################### for 24 bit icons ######################
|
||||
case 24:
|
||||
for($y=0; $y<$ico_size; $y++)
|
||||
{
|
||||
for($x=0; $x<$ico_size; $x++)
|
||||
{
|
||||
$valpha = ($alpha[$off]=='1') ? 127 : 0;
|
||||
$color = imagecolorallocatealpha($im, $arraycolor[$off*3+2], $arraycolor[$off*3+1], $arraycolor[$off*3], $valpha);
|
||||
imagesetpixel ($im, $x, $ico_size-1-$y, $color);
|
||||
$off++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
###################### for 08 bit icons ######################
|
||||
case 8:
|
||||
for($y=0; $y<$ico_size; $y++)
|
||||
{
|
||||
for($x=0; $x<$ico_size; $x++)
|
||||
{
|
||||
$valpha = ($alpha[$off]=='1') ? 127 : 0;
|
||||
$c = $arraycolor[$off];
|
||||
$c = $bitmap_info['colors'][$c];
|
||||
$color = imagecolorallocatealpha($im, $c['rgbRed'], $c['rgbGreen'], $c['rgbBlue'], $valpha);
|
||||
imagesetpixel ($im, $x, $ico_size-1-$y, $color);
|
||||
$off++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
###################### for 04 bit icons ######################
|
||||
# 318 = 22 (header) + 40 (bitmap_info) + 16 * 4 (colors) + 128 (pixels) + 64 (mask)
|
||||
case 4:
|
||||
for($y=0; $y<$ico_size; $y++)
|
||||
{
|
||||
for($x=0; $x<$ico_size; $x++)
|
||||
{
|
||||
$valpha = ($alpha[$off]=='1') ? 127 : 0;
|
||||
$c = ($arraycolor[floor($off/2)]);
|
||||
$c = str_pad(decbin($c), 8, '0', STR_PAD_LEFT);
|
||||
$m = (fmod($off+1, 2)==0) ? 1 : 0;
|
||||
$c = bindec(substr($c, $m*4, 4));
|
||||
$c = $bitmap_info['colors'][$c];
|
||||
$color = imagecolorallocatealpha($im, $c['rgbRed'], $c['rgbGreen'], $c['rgbBlue'], $valpha);
|
||||
imagesetpixel ($im, $x, $ico_size-1-$y, $color);
|
||||
$off++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
###################### for 01 bit icons ######################
|
||||
# 198 = 22 (header) + 40 (bitmap_info) + 2 * 4 (colors) + 64 (pixels, but real 32 needed?) + 64 (mask)
|
||||
case 1:
|
||||
for($y=0; $y<$ico_size; $y++)
|
||||
{
|
||||
for($x=0; $x<$ico_size; $x++)
|
||||
{
|
||||
$valpha = ($alpha[$off]=='1') ? 127 : 0;
|
||||
$c = ($arraycolor[floor($off/8)]); # ...... .... ...... 8 ........
|
||||
$c = str_pad(decbin($c), 8, '0', STR_PAD_LEFT);
|
||||
$m = fmod($off+8, 8) + 1; # bit number
|
||||
$c = (int) substr($c, $m-1, 1);
|
||||
$c = $bitmap_info['colors'][$c];
|
||||
$color = imagecolorallocatealpha($im, $c['rgbRed'], $c['rgbGreen'], $c['rgbBlue'], $valpha);
|
||||
imagesetpixel ($im, $x, $ico_size-1-$y, $color);
|
||||
$off++;
|
||||
}
|
||||
$off = $off + 16;
|
||||
}
|
||||
break;
|
||||
|
||||
##############################################################
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
# output png
|
||||
ob_start();
|
||||
# imagesavealpha($im, true);
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
$res = ob_get_clean();
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
13
bookmarks/generate.php
Normal file
13
bookmarks/generate.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
echo '<table>';
|
||||
$row = 1;
|
||||
$handle = fopen("bookmarks.csv", "r");
|
||||
while (($data = fgetcsv($handle, 300, ";")) !== FALSE) {
|
||||
echo '<tr><td style="border-bottom: 1px solid grey;">' . $row++ . '</td><td style="border-bottom: 1px solid grey;">' . (($data[2] != '') ? '<img style="height: 16px; width: 16px;" src="' . $data[2] . '" alt="" />' : ' ') . '</td><td style="border-bottom: 1px solid grey;"><a href="' . $data[1] . '">' . $data[3] . '</a></td></tr>' . "\n";
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
echo '</table>';
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue