Bywalec
Postów: 343 Pomógł: 1
Data rejestracji: 29.07.2004 23:20
|
Witam,
Powstał sobie MOD, który przestarzałe GIF'y i JPG zmieni na PNG - jeśli oczywiście istnieją - w przeciwnym razie odpali stary format pliku. Nie jest zbyt skomplikowany, ale swoje zadanie skutecznie wypełnia. Od tej chwili każdy Designer będzie mógł w pełni wykorzystać siłę PNG.. :)
Plik: includes/system_images.php w całości powinien wyglądać następująco:<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: system_images.php
| Author: Max "Matonor" Toball
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
cache_smileys();
$smiley_images = array();
foreach ($smiley_cache as $smiley) {
$smiley_images["smiley_".$smiley['smiley_text']] = IMAGES."smiley/".$smiley['smiley_image'];
}
$result = dbquery("SELECT news_cat_image, news_cat_name FROM ".DB_NEWS_CATS);
if(file_exists(IMAGES."imagenotfound.png")){$imagenotfound = IMAGES."imagenotfound.png";}else{$imagenotfound = IMAGES."imagenotfound.jpg";}
$nc_images = array();
while ($data = dbarray($result)) {
$nc_images["nc_".$data['news_cat_name']] = file_exists(IMAGES_NC.$data['news_cat_image']) ? IMAGES_NC.$data['news_cat_image'] : $imagenotfound;
}
$result = dbquery("SELECT admin_title, admin_image FROM ".DB_ADMIN);
if(file_exists(ADMIN."images/infusion_panel.gif")){$infusion_panel = ADMIN."images/infusion_panel.gif";}else{$infusion_panel = ADMIN."images/infusion_panel.gif";}
$ac_images = array();
while($data = dbarray($result)){
$ac_images["ac_".$data['admin_title']] = file_exists(ADMIN."images/".$data['admin_image']) ? ADMIN."images/".$data['admin_image'] : $infusion_panel;
}
//A
//B
if(file_exists(THEME."images/blank.png")){$blank_icon = THEME."images/blank.png";}else{$blank_icon = THEME."images/blank.gif";}
//C
//D
if(file_exists(THEME."images/down.png")){$down_icon = THEME."images/down.png";}else{$down_icon = THEME."images/down.gif";}
//E
if(file_exists(BASEDIR."images/edit.png")){$edit_icon = BASEDIR."images/edit.png";}else{$edit_icon = BASEDIR."images/edit.gif";}
//F
if(file_exists(THEME."forum/folder.png")){$folder_icon = THEME."forum/folder.png";}else{$folder_icon = THEME."forum/folder.gif";}
if(file_exists(THEME."forum/folderlock.png")){$folderlock_icon = THEME."forum/folderlock.png";}else{$folderlock_icon = THEME."forum/folderlock.gif";}
if(file_exists(THEME."forum/foldernew.png")){$foldernew_icon = THEME."forum/foldernew.png";}else{$foldernew_icon = THEME."forum/foldernew.gif";}
if(file_exists(THEME."forum/edit.png")){$forum_edit_icon = THEME."forum/edit.png";}else{$forum_edit_icon = THEME."forum/edit.gif";}
//G
//H
//I
if(file_exists(IMAGES."imagenotfound.png")){$imagenotfound_icon = IMAGES."imagenotfound.png";}else{$imagenotfound_icon = IMAGES."imagenotfound.jpg";}
//J
//K
//L
if(file_exists(THEME."images/left.png")){$left_icon = THEME."images/left.png";}else{$left_icon = THEME."images/left.gif";}
//M
//N
if(file_exists(THEME."forum/newthread.png")){$newthread_icon = THEME."forum/newthread.png";}else{$newthread_icon = THEME."forum/newthread.gif";}
//O
//P
if(file_exists(THEME."images/panel_on.png")){$panel_on_icon = THEME."images/panel_on.png";}else{$panel_on_icon = THEME."images/panel_on.gif";}
if(file_exists(THEME."images/panel_off.png")){$panel_off_icon = THEME."images/panel_off.png";}else{$panel_off_icon = THEME."images/panel_off.gif";}
if(file_exists(THEME."forum/pm.png")){$pm_icon = THEME."forum/pm.png";}else{$pm_icon = THEME."forum/pm.gif";}
if(file_exists(THEME."images/pollbar.png")){$pollbar_icon = THEME."images/pollbar.png";}else{$pollbar_icon = THEME."images/pollbar.gif";}
if(file_exists(THEME."images/printer.png")){$printer_icon = THEME."images/printer.png";}else{$printer_icon = THEME."images/printer.gif";}
//Q
if(file_exists(THEME."forum/quote.png")){$quote_icon = THEME."forum/quote.png";}else{$quote_icon = THEME."forum/quote.gif";}
//R
if(file_exists(THEME."forum/reply.png")){$reply_icon = THEME."forum/reply.png";}else{$reply_icon = THEME."forum/reply.gif";}
if(file_exists(THEME."images/right.png")){$righ_icon = THEME."images/right.png";}else{$righ_icon = THEME."images/right.gif";}
//S
if(file_exists(IMAGES."star.png")){$star_icon = IMAGES."star.png";}else{$star_icon = IMAGES."star.gif";}
if(file_exists(THEME."forum/stickythread.png")){$stickythread_icon = THEME."forum/stickythread.png";}else{$stickythread_icon = THEME."forum/stickythread.gif";}
//T
//U
if(file_exists(THEME."images/up.png")){$up_icon = THEME."images/up.png";}else{$up_icon = THEME."images/up.gif";}
//V
//W
if(file_exists(THEME."forum/web.png")){$web_icon = THEME."forum/web.png";}else{$web_icon = THEME."forum/web.gif";}
//X
//Y
//Z
$fusion_images = array(
//A
//B
"blank" => $blank_icon,
//C
//D
"down" => $down_icon,
//E
"edit" => $edit_icon,
//F
"folder" => $folder_icon,
"folderlock" => $folderlock_icon,
"foldernew" => $foldernew_icon,
"forum_edit" => $forum_edit_icon,
//G
//H
//I
"imagenotfound" => $imagenotfound_icon,
//J
//K
//L
"left" => $left_icon,
//M
//N
"newthread" => $newthread_icon,
//O
//P
"panel_on" => $panel_on_icon,
"panel_off" => $panel_off_icon,
"pm" => $pm_icon,
"pollbar" => $pollbar_icon,
"printer" => $printer_icon,
//Q
"quote" => $quote_icon,
//R
"reply" => $reply_icon,
"right" => $righ_icon,
//S
"star" => $star_icon,
"stickythread" => $stickythread_icon,
//T
//U
"up" => $up_icon,
//V
//W
"web" => $web_icon
//X
//Y
//Z
);
$fusion_images = array_merge($ac_images, $fusion_images, $nc_images, $smiley_images);
function get_image($image, $alt = "", $style = "", $title = "", $atts = "") {
global $fusion_images;
if (isset($fusion_images[$image])) {
$url = $fusion_images[$image];
} else {
if(file_exists(IMAGES."not_found.png")){$url = IMAGES."not_found.png";}else{$url = IMAGES."not_found.gif";}
}
if (!$alt && !$style && !$title) {
return $url;
} else {
return "<img src='".$url."' alt='".$alt."'".($style ? " style='$style'" : "").($title ? " title='".$title."'" : "")." ".$atts." />";
}
}
function set_image($name, $new_dir){
global $fusion_images;
$fusion_images[$name] = $new_dir;
}
function redirect_img_dir($source, $target){
global $fusion_images;
$new_images = array();
foreach ($fusion_images as $name => $url) {
$new_images[$name] = str_replace($source, $target, $url);
}
$fusion_images = $new_images;
}
?> Kliknij i zaczekaj na załadowanie kodu ...
Nazwenictwo musi pozostać takie same - zmieniamy tylko rozszerzenia.
Pozdro,
~ zer0
Edytowane przez zer0 dnia 18.08.2009 21:17:48
|