Автоматическая загрузка картинок на веб-сайт
Данный мод полезен для тех, кто повсевременно сталкивается с тем, что рисунки к новостям не заливают на веб-сайт. Этот мод облегчит работу, автоматом обусловит где в добавлении писалась картина и ежели она не на сервере, то заливает её. По другому ежели на сервере, то оставляет как есть.
Сделайте файл image_function.php и вставьте в него :
reset_url($_SERVER['HTTP_HOST'])!=$this->reset_url($item))
{
if (!(in_array ($item, $this->images)))
{
$this->images[] = $item;
continue;
}
}
}
}
}
function download ($image_url)
{
global $config;
$image_name = basename ($image_url);
$image_arr = explode ('_', $image_name);
if (count ($image_arr) != 0)
{
$image_name = end ($image_arr);
}
$image_name = $this->prefix . '_' . $image_name;
$serv_image_url = $config['http_home_url'] . 'uploads/posts/' . $image_name;
$this->source = str_replace ($image_url, $serv_image_url, $this->source);
@copy ($image_url, UPLOAD_PATH . $image_name);
if (!(in_array (basename ($serv_image_url), $this->upload_images)))
{
$this->upload_images[] = basename ($serv_image_url);
}
}
function process ($parse)
{
$source = preg_replace( "'[thumb]([^[]*)([/\])(.*?)[/thumb]'ie", "$this->build_thumb('$1$2$3', '$1$2thumbs$2$3')", $source );
$source = preg_replace( "'[thumb=(.*?)]([^[]*)([/\])(.*?)[/thumb]'ie", "$this->build_thumb('$2$3$4', '$2$3thumbs$3$4', '$1')", $source );
$this->source = $parse->decodeBBCodes($this->source);
$this->prefix = time ();
if (trim ($this->source) != '')
{
$this->get_images ($this->source);
}
foreach ($this->images as $image_url)
{
$this->download ($image_url);
}
}
}
define ('UPLOAD_PATH', ROOT_DIR . '/uploads/posts/');
?>
{
if (!(in_array ($item, $this->images)))
{
$this->images[] = $item;
continue;
}
}
}
}
}
function download ($image_url)
{
global $config;
$image_name = basename ($image_url);
$image_arr = explode ('_', $image_name);
if (count ($image_arr) != 0)
{
$image_name = end ($image_arr);
}
$image_name = $this->prefix . '_' . $image_name;
$serv_image_url = $config['http_home_url'] . 'uploads/posts/' . $image_name;
$this->source = str_replace ($image_url, $serv_image_url, $this->source);
@copy ($image_url, UPLOAD_PATH . $image_name);
if (!(in_array (basename ($serv_image_url), $this->upload_images)))
{
$this->upload_images[] = basename ($serv_image_url);
}
}
function process ($parse)
{
$source = preg_replace( "'[thumb]([^[]*)([/\])(.*?)[/thumb]'ie", "$this->build_thumb('$1$2$3', '$1$2thumbs$2$3')", $source );
$source = preg_replace( "'[thumb=(.*?)]([^[]*)([/\])(.*?)[/thumb]'ie", "$this->build_thumb('$2$3$4', '$2$3thumbs$3$4', '$1')", $source );
$this->source = $parse->decodeBBCodes($this->source);
$this->prefix = time ();
if (trim ($this->source) != '')
{
$this->get_images ($this->source);
}
foreach ($this->images as $image_url)
{
$this->download ($image_url);
}
}
}
define ('UPLOAD_PATH', ROOT_DIR . '/uploads/posts/');
?>
Расположите его в engine/inc
Установка:
Откройте файл engine/classes/parse.class.php и найдите:
function process($source) {
Ниже вставьте:
require_once ENGINE_DIR.'/inc/image_function.php';
$i_control = new image_controller();
$i_control->source = $source;
$i_control->process($this);
$source = $i_control->source;
$i_control = new image_controller();
$i_control->source = $source;
$i_control->process($this);
$source = $i_control->source;
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь. Мы рекомендуем Вам зарегистрироваться либо зайти на сайт под своим именем.
| #1 написал: ruxx (5 января 2010 03:34) | |
|---|---|
|
Группа: Гости Регистрация: -- |
сначала, вообщем то, нехватает вроде как <php :D
|
| ICQ: -- | |
| #2 написал: extz (5 января 2010 23:18) | |
|---|---|
|
Группа: Гости Регистрация: -- |
<?php - а конкретно =)
|
| ICQ: -- | |
| #3 написал: korovka (7 января 2010 19:09) | |
|---|---|
|
Группа: Гости Регистрация: -- |
Не только лишь
... continue; } } } } } function download ($image_url) .... |
| ICQ: -- | |
| #4 написал: 0904 (16 января 2010 01:01) | |
|---|---|
|
Группа: Гости Регистрация: -- |
Да уж, кривой до невозможности
|
| ICQ: -- | |
| #5 написал: GrEgOrY (29 января 2010 17:55) | |
|---|---|
|
Группа: Гости Регистрация: -- |
Я его поначалу ставил, а он **** не работал
|
| ICQ: -- | |
| #6 написал: kamon (28 февраля 2010 08:19) | |
|---|---|
|
Группа: Гости Регистрация: -- |
кривоват скриптик
------------------------------------------------------------- Все самое смачное в сети http://www.vipmain.ru |
| ICQ: -- | |
