Exemplo n.º 1
0
function multy_update_photo_news($_table_name, $_dir_name, $_count_photo, $id)
{
    //echo "<pre>".print_r($_FILES,1)."</pre>";
    // проверяем на картинку
    for ($i = 1; $i <= $_count_photo; $i++) {
        // имя картинки
        $file_name = "file" . $i;
        if ($_FILES[$file_name]['name'] != "") {
            //$name_file_destination=$id.".jpg";
            $name_file_destination = $id . ".jpg";
            // -------------------------------------------------------------------
            $fileuplo = $_FILES[$file_name]['tmp_name'];
            move_uploaded_file($fileuplo, HOST . '/images/' . $_dir_name . '/' . md5($_FILES[$file_name]['name']));
            $fileuplo = HOST . '/images/' . $_dir_name . '/' . md5($_FILES[$file_name]['name']);
            // -------------------------------------------------------------------
            $filename = HOST . '/images/' . $_dir_name . '/' . $name_file_destination;
            copy_and_resize_image($fileuplo, $filename, 250, 250);
            $filename1 = HOST . '/images/' . $_dir_name . '/_' . $name_file_destination;
            copy_and_resize_image_new($filename, $filename1, _NEWS_WIDTH, _NEWS_HEIGHT);
            // удаляем загруженное фото
            if (file_exists($fileuplo)) {
                unlink($fileuplo);
            }
        }
    }
}
Exemplo n.º 2
0
function multy_update_photo($_table_name, $_dir_name, $_count_photo, $id)
{
    //echo "<pre>".print_r($_FILES,1)."</pre>";
    // проверяем на картинку
    for ($i = 1; $i <= $_count_photo; $i++) {
        // имя картинки
        $file_name = "file" . $i;
        if ($_FILES[$file_name]['name'] != "") {
            //$name_file_destination=$id.".jpg";
            $name_file_destination = $id . "_" . $i . ".jpg";
            // -------------------------------------------------------------------
            $fileuplo = $_FILES[$file_name]['tmp_name'];
            move_uploaded_file($fileuplo, HOST . '/images/' . $_dir_name . '/' . md5($_FILES[$file_name]['name']));
            $fileuplo = HOST . '/images/' . $_dir_name . '/' . md5($_FILES[$file_name]['name']);
            // -------------------------------------------------------------------
            $filename = HOST . '/images/' . $_dir_name . '/__' . $name_file_destination;
            copy_and_resize_image_new($fileuplo, $filename, _SIZE_01, _SIZE_011);
            $filename = HOST . '/images/' . $_dir_name . '/_' . $name_file_destination;
            //copy_and_resize_image_new ($fileuplo, $filename, _SIZE_02, _SIZE_022);
            copy_and_resize_image_new($fileuplo, $filename, _SIZE_02, _SIZE_022);
            // + watermark
            copy_and_resize_image_watermark1($fileuplo, $filename);
            // сохраняем большую картику без watermark
            $filename = HOST . '/images/' . $_dir_name . '/original/' . $id . "_" . $i . ".jpg";
            copy_and_resize_image($fileuplo, $filename, _SIZE_03, _SIZE_033);
            $filename = HOST . '/images/' . $_dir_name . '/' . $name_file_destination;
            copy_and_resize_image($fileuplo, $filename, _SIZE_03, _SIZE_033);
            // + watermark
            copy_and_resize_image_watermark($fileuplo, $filename);
            // удаляем загруженное фото
            if (file_exists($fileuplo)) {
                unlink($fileuplo);
            }
        }
    }
    /*
     * есть картинка - апдейт поле
     */
    $_is_photo = is_photo_new($id . "_1.jpg", $_dir_name);
    f_mysql_connect();
    f_mysql_update($_table_name, "is_photo", $_is_photo, " WHERE id={$id}");
}