function imageProcess($img_info)
{
    $file = $img_info['img_upload_url_temp'] . $img_info['img'];
    $sizeInfo = getimagesize($file);
    if (is_array($sizeInfo)) {
        include_once 'libraries/SimpleImage.php';
        $image = new SimpleImage();
        $image->load($file);
        $width = $sizeInfo[0];
        $height = $sizeInfo[1];
        //img thumb
        $img_thumb = $img_info['img_upload_url_thumb'] . $img_info['img'];
        if ($width <= IMAGE_THUMB_WIDTH && $height <= IMAGE_THUMB_HEIGHT) {
            copy($file, $img_thumb);
        } elseif ($width >= $height) {
            $image->resizeToWidth(IMAGE_THUMB_WIDTH);
            $image->save($img_thumb);
        } elseif ($width < $height) {
            $image->resizeToHeight(IMAGE_THUMB_HEIGHT);
            $image->save($img_thumb);
        }
        //img
        $img = $img_info['img_upload_url'] . $img_info['img'];
        if ($img_info['original'] == 1) {
            $image->load($file);
            if ($width >= $height && $width > IMAGE_MAX_WIDTH) {
                $image->resizeToWidth(IMAGE_MAX_WIDTH);
                $image->save($img);
            } elseif ($width <= $height && $height > IMAGE_MAX_HEIGHT) {
                $image->resizeToHeight(IMAGE_MAX_HEIGHT);
                $image->save($img);
            } else {
                copy($file, $img);
            }
            if (file_exists($file)) {
                unlink($file);
            }
        } else {
            if (copy($file, $img)) {
                if (file_exists($file)) {
                    unlink($file);
                }
            }
        }
        return true;
    } else {
        return false;
    }
}
 /**
  * 上传图片
  */
 public function actionUpload()
 {
     $fn = $_GET['CKEditorFuncNum'];
     $url = WaveCommon::getCompleteUrl();
     $imgTypeArr = WaveCommon::getImageTypes();
     if (!in_array($_FILES['upload']['type'], $imgTypeArr)) {
         echo '<script type="text/javascript">
             window.parent.CKEDITOR.tools.callFunction("' . $fn . '","","图片格式错误!");
             </script>';
     } else {
         $projectPath = Wave::app()->projectPath;
         $uploadPath = $projectPath . 'data/uploadfile/substance';
         if (!is_dir($uploadPath)) {
             mkdir($uploadPath, 0777);
         }
         $ym = WaveCommon::getYearMonth();
         $uploadPath .= '/' . $ym;
         if (!is_dir($uploadPath)) {
             mkdir($uploadPath, 0777);
         }
         $imgType = strtolower(substr(strrchr($_FILES['upload']['name'], '.'), 1));
         $imageName = time() . '_' . rand() . '.' . $imgType;
         $file_abso = $url . '/data/uploadfile/substance/' . $ym . '/' . $imageName;
         $SimpleImage = new SimpleImage();
         $SimpleImage->load($_FILES['upload']['tmp_name']);
         $SimpleImage->resizeToWidth(800);
         $SimpleImage->save($uploadPath . '/' . $imageName);
         echo '<script type="text/javascript">
             window.parent.CKEDITOR.tools.callFunction("' . $fn . '","' . $file_abso . '","上传成功");
             </script>';
     }
 }
Beispiel #3
0
 protected function uploadFile()
 {
     if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $this->path)) {
         $path = $this->path;
         if (!$this->db->query("INSERT photo (name,folder,time,status) \n\t\t\tVALUES ('" . $this->name . "','" . $this->folder . "','" . time() . "','temp')")) {
             die("error");
         }
         $id = $this->db->getLastId();
         $this->image->load($path);
         $full = new SimpleImage();
         $full->load($path);
         if ($full->getWidth() > 1200) {
             $full->resizeToWidth(1200);
         }
         $full->save(str_replace('.', '.full.', $path));
         if ($this->image->getWidth() > 600) {
             $this->image->resizeToWidth(600);
         }
         $this->image->save($path);
         $size = $this->f->getFullSize($path, 90, 90);
         $img = array('name' => $this->name, 'path' => $path, 'count' => $this->getNum(), 'width' => $size['width'], 'height' => $size['height'], 'id' => $id);
         echo json_encode($img);
     } else {
         echo "error";
     }
 }
function upload_imagem_unica($pasta_upload, $novo_tamanho_imagem, $novo_tamanho_imagem_miniatura, $host_retorno, $upload_miniatura)
{
    // data atual
    $data_atual = data_atual();
    // array com fotos
    $fotos = $_FILES['foto'];
    // extensoes de imagens disponiveis
    $extensoes_disponiveis[] = ".jpeg";
    $extensoes_disponiveis[] = ".jpg";
    $extensoes_disponiveis[] = ".png";
    $extensoes_disponiveis[] = ".gif";
    $extensoes_disponiveis[] = ".bmp";
    // nome imagem
    $nome_imagem = $fotos['tmp_name'];
    $nome_imagem_real = $fotos['name'];
    // dimensoes da imagem
    $image_info = getimagesize($_FILES["foto"]["tmp_name"]);
    $largura_imagem = $image_info[0];
    $altura_imagem = $image_info[1];
    // extencao
    $extensao_imagem = "." . strtolower(pathinfo($nome_imagem_real, PATHINFO_EXTENSION));
    // nome final de imagem
    $nome_imagem_final = md5($nome_imagem_real . $data_atual) . $extensao_imagem;
    $nome_imagem_final_miniatura = md5($nome_imagem_real . $data_atual . $data_atual) . $extensao_imagem;
    // endereco final de imagem
    $endereco_final_salvar_imagem = $pasta_upload . $nome_imagem_final;
    $endereco_final_salvar_imagem_miniatura = $pasta_upload . $nome_imagem_final_miniatura;
    // informa se a extensao de imagem e permitida
    $extensao_permitida = retorne_elemento_array_existe($extensoes_disponiveis, $extensao_imagem);
    // se nome for valido entao faz upload
    if ($nome_imagem != null and $nome_imagem_real != null and $extensao_permitida == true) {
        // upload de imagem normal
        $image = new SimpleImage();
        $image->load($nome_imagem);
        // aplica escala
        if ($largura_imagem > $novo_tamanho_imagem) {
            $image->resizeToWidth($novo_tamanho_imagem);
        }
        // salva a imagem grande
        $image->save($endereco_final_salvar_imagem);
        // upload de miniatura
        if ($upload_miniatura == true) {
            $image = new SimpleImage();
            $image->load($nome_imagem);
            // modo de redimencionar
            if ($largura_imagem > $novo_tamanho_imagem_miniatura) {
                $image->resizeToWidth($novo_tamanho_imagem_miniatura);
            }
            // salva a imagem em miniatura
            $image->save($endereco_final_salvar_imagem_miniatura);
        }
        // array de retorno
        $retorno['normal'] = $host_retorno . $nome_imagem_final;
        $retorno['miniatura'] = $host_retorno . $nome_imagem_final_miniatura;
        $retorno['normal_root'] = $endereco_final_salvar_imagem;
        $retorno['miniatura_root'] = $endereco_final_salvar_imagem_miniatura;
        // retorno
        return $retorno;
    }
}
Beispiel #5
0
function resizeImagesInFolder($dir, $i)
{
    if (!is_dir('cover/' . $dir)) {
        toFolder('cover/' . $dir);
    }
    $files = scandir($dir);
    foreach ($files as $key => $file) {
        if ($file != '.' && $file != '..') {
            if (!is_dir($dir . '/' . $file)) {
                echo $dir . '/' . $file;
                $image = new SimpleImage();
                $image->load($dir . '/' . $file);
                if ($image->getHeight() < $image->getWidth()) {
                    $image->resizeToWidth(1920);
                } else {
                    $image->resizeToHeight(1920);
                }
                // $new = 'cover/' . $dir . '/'.$image->name;
                if ($i < 10) {
                    $new = 'cover/' . $dir . '/00' . $i . '.' . $image->type;
                } elseif ($i < 100) {
                    $new = 'cover/' . $dir . '/0' . $i . '.' . $image->type;
                } else {
                    $new = 'cover/' . $dir . '/' . $i . '.' . $image->type;
                }
                $image->save($new);
                echo ' ---------> ' . $new . '<br>';
                $i++;
            } else {
                resizeImagesInFolder($dir . '/' . $file, 1);
            }
        }
    }
}
Beispiel #6
0
 /**
  * Generates the thumbnail for a given file.
  */
 protected function _generateThumbnail()
 {
     $image = new SimpleImage();
     $image->load($this->source);
     $image->resizeToWidth(Configure::read('Image.width'));
     $image->save($this->thumb_path);
 }
Beispiel #7
0
function processScreenshots($gameID)
{
    ## Select all fanart rows for the requested game id
    $ssResult = mysql_query(" SELECT filename FROM banners WHERE keyvalue = {$gameID} AND keytype = 'screenshot' ORDER BY filename ASC ");
    ## Process each fanart row incrementally
    while ($ssRow = mysql_fetch_assoc($ssResult)) {
        ## Construct file names
        $ssOriginal = $ssRow['filename'];
        $ssThumb = "screenshots/thumb" . str_replace("screenshots", "", $ssRow['filename']);
        ## Check to see if the original fanart file actually exists before attempting to process
        if (file_exists("../banners/{$ssOriginal}")) {
            ## Check if thumb already exists
            if (!file_exists("../banners/{$ssThumb}")) {
                ## If thumb is non-existant then create it
                $image = new SimpleImage();
                $image->load("../banners/{$ssOriginal}");
                $image->resizeToWidth(300);
                $image->save("../banners/{$ssThumb}");
                //makeFanartThumb("../banners/$ssOriginal", "../banners/$ssThumb");
            }
            ## Get Fanart Image Dimensions
            list($image_width, $image_height, $image_type, $image_attr) = getimagesize("../banners/{$ssOriginal}");
            $ssWidth = $image_width;
            $ssHeight = $image_height;
            ## Output Fanart XML Branch
            print "<screenshot>\n";
            print "<original width=\"{$ssWidth}\" height=\"{$ssHeight}\">{$ssOriginal}</original>\n";
            print "<thumb>{$ssThumb}</thumb>\n";
            print "</screenshot>\n";
        }
    }
}
function xulyImage($img, $urlImgTemp, $urlImg, $urlImgThumb, $original = 1)
{
    $file = $urlImgTemp . $img;
    $sizeInfo = getimagesize($file);
    if (is_array($sizeInfo)) {
        include_once 'libraries/SimpleImage.php';
        $image = new SimpleImage();
        $image->load($file);
        $width = $sizeInfo[0];
        $height = $sizeInfo[1];
        if ($width <= IMAGE_THUMB_WIDTH && $height <= IMAGE_THUMB_HEIGHT) {
            copy($file, $urlImgThumb . $img);
        } elseif ($width >= $height) {
            $image->resizeToWidth(IMAGE_THUMB_WIDTH);
            $image->save($urlImgThumb . $img);
        } elseif ($width < $height) {
            $image->resizeToHeight(IMAGE_THUMB_HEIGHT);
            $image->save($urlImgThumb . $img);
        }
        if ($original == 1) {
            $image->load($file);
            if ($width >= $height && $width > IMAGE_MAX_WIDTH) {
                $image->resizeToWidth(IMAGE_MAX_WIDTH);
                $image->save($urlImg . $img);
            } elseif ($width <= $height && $height > IMAGE_MAX_HEIGHT) {
                $image->resizeToHeight(IMAGE_MAX_HEIGHT);
                $image->save($urlImg . $img);
            } else {
                copy($file, $urlImg . $img);
            }
            if (file_exists($file)) {
                unlink($file);
            }
        } else {
            if (copy($file, $urlImg . $img)) {
                if (file_exists($file)) {
                    unlink($file);
                }
            }
        }
        return true;
    } else {
        return false;
    }
}
 private function _write_product_image($file = '', $prd_id = '')
 {
     $val = rand(999, 99999999);
     $image_name = "PRO" . $val . $prd_id . ".png";
     //$this->upload_image($file, $image_name);
     $this->request->data['Product']['image'] = $image_name;
     $this->request->data['Product']['id'] = $prd_id;
     $this->Product->save($this->request->data, false);
     /* if (!empty($file)) {
            $this->FileWrite->file_write_path = PRODUCT_IMAGE_PATH;
            $this->FileWrite->_write_file($file, $image_name);
        }*/
     include "SimpleImage.php";
     $image = new SimpleImage();
     if (!empty($file)) {
         $image->load($file['tmp_name']);
         $image->save(PRODUCT_IMAGE_PATH . $image_name);
         $image->resizeToWidth(150, 150);
         $image->save(PRODUCT_IMAGE_THUMB_PATH . $image_name);
     }
 }
Beispiel #10
0
 public static function get($image_url, $width = NULL)
 {
     $cached_image = '';
     if (!empty($image_url)) {
         // Get file name
         $exploded_image_url = explode("/", $image_url);
         $image_filename = end($exploded_image_url);
         $exploded_image_filename = explode(".", $image_filename);
         $extension = end($exploded_image_filename);
         // Image validation
         if (strtolower($extension) == "gif" || strtolower($extension) == "jpg" || strtolower($extension) == "png") {
             $cached_image = self::$image_path . $image_filename;
             // Check if image exists
             if (file_exists($cached_image)) {
                 return $cached_image;
             } else {
                 // Get remote image
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $image_url);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 $image_to_fetch = curl_exec($ch);
                 curl_close($ch);
                 // Save image
                 $local_image_file = fopen($cached_image, 'w+');
                 chmod($cached_image, 0755);
                 fwrite($local_image_file, $image_to_fetch);
                 fclose($local_image_file);
                 // Resize image
                 if (!is_null($width)) {
                     $image = new SimpleImage();
                     $image->load($cached_image);
                     $image->resizeToWidth($width);
                     $image->save($cached_image);
                 }
             }
         }
     }
     return $cached_image;
 }
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($_POST["MM_insert"]) && $_POST["MM_insert"] == "form1") {
    include 'simple_image.php';
    // define constant for upload folder
    define('UPLOAD_DIR', 'C:\\inetpub\\vhosts\\wsso.org\\httpdocs\\staging/extra_images/');
    // replace any spaces in original filename with underscores
    $file = str_replace(' ', '_', $_FILES['image']['name']);
    // create an array of permitted MIME types
    $permitted = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png');
    $uid = uniqid();
    $file = $uid . "_" . $file;
    $image = new SimpleImage();
    $image->load($_FILES['image']['tmp_name'], UPLOAD_DIR . $file);
    $image->resizeToWidth(338);
    $image->save(UPLOAD_DIR . $file);
    $insertSQL = sprintf("INSERT INTO x_wp_extra_conductor (ex_id, conductor, conductor_image) VALUES (%s, %s, %s)", GetSQLValueString($_POST['ex_id'], "int"), GetSQLValueString($_POST['conductor'], "text"), GetSQLValueString($file, "text"));
    mysql_select_db($database_x_wsso, $x_wsso);
    $Result1 = mysql_query($insertSQL, $x_wsso) or die(mysql_error());
    $insertGoTo = "event_detail.php?post_id=" . $colname_get_extra;
    if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= strpos($insertGoTo, '?') ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Beispiel #12
0
     if (is_dir($uploaddir)) {
         if (chmod($uploaddir, 0777)) {
             $intBool = chmod($uploaddir, 0777);
             if (!$intBool) {
                 $strErrormessage .= "Please give premission to the upload folder in images folder as 777.<br>";
                 $intError = 0;
             }
         }
     }
     if ($_FILES['img']['error'] == 0) {
         if ($strExtension == "jpg" || $strExtension == "jpeg" || $strExtension == "gif" || $strExtension == "png") {
             if (move_uploaded_file($_FILES['img']['tmp_name'], $uploadfile)) {
                 if ($width > 100) {
                     $image = new SimpleImage();
                     $image->load($uploadfile);
                     $image->resizeToWidth(100);
                     $image->save($uploadfile);
                 }
                 $strfilename = $filename;
             }
         } else {
             $strErrormessage .= "Please upload only gif, jpg or png image.<br>";
             $intError = 0;
         }
     }
 }
 if ($intError) {
     foreach ($_POST as $key => $value) {
         $_POST[$key] = mysql_escape_string(trim($value));
     }
     $sql = "INSERT INTO tblmodule(id,course_id,page_name,mname,by_whom,mdescription,img_path,morder,fname,dtcreated) VALUES('','" . $_POST["course_id"] . "','" . $_POST["page_name"] . "','" . $_POST["mname"] . "','" . $_POST["by_whom"] . "','" . $_POST["mdescription"] . "','" . $strfilename . "','" . $_POST["morder"] . "','" . $_POST["fname"] . "','" . date("Y-m-d H:i:s") . "')";
Beispiel #13
0
function uploadImage($fileID, $directory, $imageWidth = NULL, $imageHeight = NULL, $thumbWidth = NULL, $thumbHeight = NULL)
{
    /*
    echo "imageWidth = |" . $imageWidth . "|<br />";
    echo "imageHeight = |" . $imageHeight . "|<br />";
    echo "thumbWidth = |" . $thumbWidth . "|<br />";
    echo "thumbHeight = |" . $thumbHeight . "|<br />";	
    */
    $FILE = $_FILES[$fileID]['tmp_name'];
    $FILE_NAME = $_FILES[$fileID]['name'];
    $fileName_final = cleanForShortURL($FILE_NAME);
    if ($FILE != NULL) {
        //////////// BIG IMAGE  /////////////////////////////////////////////////////////
        // If big image is required.
        if ($imageWidth != NULL || $imageHeight != NULL) {
            if (is_numeric($imageWidth) || is_numeric($imageHeight)) {
                // resample image
                $image = new SimpleImage();
                $image->load($FILE);
                if (is_numeric($imageWidth) && is_numeric($imageHeight)) {
                    if ($image->getWidth() > $imageWidth || $image->getHeight() > $imageHeight) {
                        if ($image->getWidth() > $imageWidth) {
                            $image->resizeToWidth($imageWidth);
                        }
                        if ($image->getHeight() > $imageHeight) {
                            $image->resizeToHeight($imageHeight);
                        }
                    }
                } else {
                    if (is_numeric($imageWidth) && !is_numeric($imageHeight)) {
                        if ($image->getWidth() > $imageWidth) {
                            $image->resizeToWidth($imageWidth);
                        }
                    } else {
                        if (!is_numeric($imageWidth) && is_numeric($imageHeight)) {
                            if ($image->getHeight() > $imageHeight) {
                                $image->resizeToHeight($imageHeight);
                            }
                        }
                    }
                }
                // if directory doesn't exist, it is created.
                if (!file_exists($directory)) {
                    mkdir($directory, 0777, true);
                }
                // save image into directory.
                $image->save($directory . $fileName_final);
            }
            // close: if(!is_numeric($imageWidth) && !is_numeric($imageHeight))
        } else {
            //Subimos la imagen con sus dimensiones originales (sin resize)
            // if directory doesn't exist, it is created.
            if (!file_exists($directory)) {
                mkdir($directory, 0777, true);
            }
            move_uploaded_file($FILE, $directory . $fileName_final);
            // Moving Uploaded imagen
        }
        //////////// THUMBNAIL  /////////////////////////////////////////////////////////
        // If thumbnail is required.
        if ($thumbWidth != NULL || $thumbHeight != NULL) {
            if (is_numeric($thumbWidth) || is_numeric($thumbHeight)) {
                // resample thumbnail
                $thumb = new SimpleImage();
                $thumb->load($FILE);
                if (is_numeric($thumbWidth) && is_numeric($thumbHeight)) {
                    if ($thumb->getWidth() > $thumbWidth || $thumb->getHeight() > $thumbHeight) {
                        if ($thumb->getWidth() > $thumbWidth) {
                            $thumb->resizeToWidth($thumbWidth);
                        }
                        if ($thumb->getHeight() > $thumbHeight) {
                            $thumb->resizeToHeight($thumbHeight);
                        }
                    }
                } else {
                    if (is_numeric($thumbWidth) && !is_numeric($thumbHeight)) {
                        if ($thumb->getWidth() > $thumbWidth) {
                            $thumb->resizeToWidth($thumbWidth);
                        }
                    } else {
                        if (!is_numeric($thumbWidth) && is_numeric($thumbHeight)) {
                            if ($thumb->getHeight() > $thumbHeight) {
                                $thumb->resizeToHeight($thumbHeight);
                            }
                        }
                    }
                }
                $thumbnailsDirectory = $directory . "thumbs/";
                // if directory doesn't exist, it is created.
                if (!file_exists($thumbnailsDirectory)) {
                    mkdir($thumbnailsDirectory, 0777, true);
                }
                // save thumb into thumbnails directory.
                $thumb->save($thumbnailsDirectory . $fileName_final);
            }
            // close: if(!is_numeric($thumbWidth) && !is_numeric($thumbHeight))
        }
        // close: if($thumbWidth != NULL || $thumbHeight != NULL)
        //////////// THUMBNAIL ENDS HERE /////////////////////////////////////////////////
        // delete temporary uploaded file.
        unlink($FILE);
        return $fileName_final;
    } else {
        // close: if($FILE != NULL)
        return NULL;
    }
}
 public function intoMedia($endereco_media, $id_estabelecimento_id, $nome_media)
 {
     $vai = new MySQLDB();
     $sql = "SELECT `folder_estabelecimento` FROM `estabelecimento` WHERE `id_estabelecimento`={$id_estabelecimento_id};";
     $result = $vai->ExecuteQuery($sql);
     while ($rows = mysql_fetch_object($result)) {
         $folder = $rows->folder_estabelecimento;
     }
     if ($folder == "") {
         header("Location: vi_estabelecimento.php?vi=nao_folder&ed={$id_estabelecimento_id}");
         exit;
     }
     foreach ($endereco_media['name'] as $key => $ui) {
         $tam_img = getimagesize($endereco_media['tmp_name'][$key]);
         if ($tam_img[0] > 870) {
             include "../../plugins/SimpleImage/SimpleImage.php";
             $image = new SimpleImage();
             $image->load($endereco_media['tmp_name'][$key]);
             $image->resizeToWidth(870);
             $image->save($endereco_media['tmp_name'][$key]);
         }
         if (strpos($endereco_media['type'][$key], "image") === false) {
             $c++;
             $erro .= "{$c} - A foto não &eacute; uma imagem. Arquivo:" . $endereco_media['name'][$key] . "<br />";
         } else {
             $nome_original = $endereco_media['name'][$key];
             list($nome_arquivo, $extensao_arquivo) = explode(".", $nome_original);
             $ds90 = str_replace(" ", "_", $nome_arquivo);
             $numero_reg = rand(1, 999);
             $nome_aleatorio_arquivo = $ds90 . "_foto_" . $numero_reg;
             $logo = "../../../img/bares/" . $folder . "/" . $nome_aleatorio_arquivo . "." . $extensao_arquivo;
             $logo_bd = "bares/" . $folder . "/" . $nome_aleatorio_arquivo . "." . $extensao_arquivo;
             if (!move_uploaded_file($endereco_media['tmp_name'][$key], "./{$logo}")) {
                 $c++;
                 $erro .= "{$c} - Erro no envio da foto.<br />";
             } else {
                 $sql = "INSERT INTO `media` (`nome_media`, `endereco_media`, `id_estabelecimento_id`, `capa`, `visualizar_media`) VALUES ('{$nome_media}', '{$logo_bd}', {$id_estabelecimento_id}, 0, 0);";
                 $vai = new MySQLDB();
                 $vai->ExecuteQuery($sql);
             }
         }
     }
     if ($erro == "") {
         header("Location: vi_estabelecimento.php?vi=foto_upload&ed={$id_estabelecimento_id}");
     } else {
         header("Location: vi_estabelecimento.php?vi=erro_foto_upload&error=" . $erro);
     }
 }
Beispiel #15
0
 $sub = $_POST['get_sub'];
 foreach ($_FILES['uploadfile']['name'] as $k => $v) {
     $u = new port_menu();
     $u->current_menu($name, 'url', 'id');
     $uploaddir = "../tree/portfolio/img/" . $u->url . "/";
     $uploaddir2 = "tree/portfolio/img/" . $u->url;
     $uploaddir3 = "../tree/portfolio/img/" . $u->url . "/thumb/";
     $apend = date('dHi') . rand(100, 1000);
     $uploadfile = $uploaddir . $apend . basename($_FILES['uploadfile']['name'][$k]);
     $uploadfile2 = $uploaddir3 . $apend . basename($_FILES['uploadfile']['name'][$k]);
     $file = $apend . basename($_FILES['uploadfile']['name'][$k]);
     $u->last_num($u->url, $sub);
     $last_num = $u->number + 1;
     $image = new SimpleImage();
     $image->load($_FILES['uploadfile']['tmp_name'][$k]);
     $image->resizeToWidth(400);
     $image->save($uploadfile2);
     // Копируем файл из каталога для временного хранения файлов:
     if (move_uploaded_file($_FILES['uploadfile']['tmp_name'][$k], $uploadfile)) {
         echo "<h3>Файл успешно загружен на сервер</h3>";
         if (isset($sub) && $sub != '') {
             $sql = "INSERT INTO `portfolio`(`category`, `file_name`, `capture`, `number`, `path`, `sub`) \nVALUES ('" . $u->url . "', '" . $file . "', '" . $text . "', '" . $last_num . "', '" . $uploaddir2 . "', '" . $sub . "')";
         } else {
             $sql = "INSERT INTO `portfolio`(`category`, `file_name`, `capture`, `number`, `path`) \nVALUES ('" . $u->url . "', '" . $file . "', '" . $text . "', '" . $last_num . "', '" . $uploaddir2 . "')";
         }
         if ($mysqli->query($sql) === TRUE) {
             echo "Запись добавлена успешно!";
             //$mysqli->close();
         } else {
             echo "Error: " . $sql . "<br>" . $conn->mysqli_error;
             $_POST['add'] = 0;
<?php

if (isset($_POST['submit'])) {
    ?>
  <?php 
    include 'classSimpleImage.php';
    $image = new SimpleImage();
    $image->load($_FILES['uploaded_image']['tmp_name']);
    $image->resizeToWidth(150);
    $image->output();
} else {
    ?>
  ?>
  <form action="upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="uploaded_image" />
    <input type="submit" name="submit" value="Upload" />
  </form>
<?php 
}
Beispiel #17
0
function resizeImagesInFolder($folder)
{
    //Time Limit vergrössern, da für viele Bilder viel Zeit in Anspruch genommen wird.
    set_time_limit(120);
    include 'includes/simpleImage.php';
    $image = new SimpleImage();
    if ($handle = opendir($folder)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                $bild_location = $folder . "/" . $file;
                $info = getimagesize($bild_location);
                $width = $info[0];
                $height = $info[1];
                echo "<b>" . $bild_location . "</b><br>";
                echo 'Old width:' . $width . '<br>height:' . $height . "<br>";
                if ($height > 700) {
                    $image->load($bild_location);
                    $image->resizeToHeight(700);
                    $image->save($bild_location);
                }
                if ($width > 1200) {
                    $image->load($bild_location);
                    $image->resizeToWidth(1200);
                    $image->save($bild_location);
                }
                $info = getimagesize($bild_location);
                $width = $info[0];
                $height = $info[1];
                echo 'New width:' . $width . '<br>height:' . $height . "<br><br><br>";
            }
        }
    }
    return true;
}
Beispiel #18
0
 $uploadsDirectoryThumb = str_replace("dashboard", "uploads", $uploadsDirectoryThumb);
 if (is_array($_FILES["file"]["error"])) {
     foreach ($_FILES["file"]["error"] as $key => $error) {
         if ($error == UPLOAD_ERR_OK) {
             $tmp_name = $_FILES["file"]["tmp_name"][$key];
             $name = $_FILES["file"]["name"][$key];
             move_uploaded_file($tmp_name, $uploadsDirectory . $hashtag . '-' . $name);
             $uploadedFiles[] = $hashtag . '-' . $name;
         }
     }
 }
 $image = new SimpleImage();
 foreach ($uploadedFiles as $upFiles) {
     //resizeImage
     $image->load($uploadsDirectory . $upFiles);
     $image->resizeToWidth(133);
     $image->resizeToHeight(110);
     $image->save($uploadsDirectoryThumb . $upFiles);
 }
 $category = explode(",", $_POST['inputCategory']);
 foreach ($category as $key => $val) {
     if ($val == "") {
         unset($category[$key]);
     } else {
         $cats = explode("-", $val);
         $category[$key] = $cats[1];
     }
 }
 $amenity = explode(",", $_POST['inputTags']);
 foreach ($amenity as $key => $val) {
     if ($val == "") {
Beispiel #19
0
        $height = 370;
        if ($w[0] < $w[1]) {
            $imagef = new SimpleImage();
            $imagef->load($file);
            $imagef->resizeToHeight($height);
            $imagef->save($file);
            $w = getimagesize($file);
            if ($w[0] > $width) {
                $imagef->resizeToWidth($width);
                $imagef->save($file);
            }
        } else {
            if ($w[0] >= $w[1]) {
                $imagef = new SimpleImage();
                $imagef->load($file);
                $imagef->resizeToWidth($width);
                $imagef->save($file);
                $w = getimagesize($file);
                if ($w[1] > $height) {
                    $imagef->resizeToHeight($height);
                    $imagef->save($file);
                }
            }
        }
        $itemid = $fs->create_file_from_pathname($file_record, $file);
        unlink($file);
        $c++;
    }
}
if (@$_FILES['i_audio']) {
    $c = 0;
    $DOC_FILE1 = $_FILES['portada']['tmp_name'];
    $DOC_FILE_NAME1 = $_FILES['portada']['name'];
    // code to resample and upload image file.
    if ($DOC_FILE1 != NULL) {
        $photos_download_dir = "../../imgs/galeria/evento_" . $next_slide . "/";
        // create the new directory if it doesn't exist.
        if (!file_exists($photos_download_dir)) {
            mkdir($photos_download_dir, 0777, true);
        }
        // change spaces to underscores in filename
        $photo_name = 'portada.jpg';
        $photo_big = new SimpleImage();
        $photo_big->load($DOC_FILE1);
        if ($photo_big->getWidth() > 2080 || $photo_big->getHeight() > 1388) {
            if ($photo_big->getWidth() > 2080) {
                $photo_big->resizeToWidth(2080);
            }
            if ($photo_big->getHeight() > 1388) {
                $photo_big->resizeToHeight(1388);
            }
        }
        // save the photo into the videogallery directory.
        $photo_big->save($photos_download_dir . $photo_name, $DOC_FILE_TYPE1);
        //END CODE TO RESAMPLE AND UPLOAD PHOTO FILE.
    }
    unlink($DOC_FILE1);
    $insertSQL = "INSERT INTO eventos (id_evento, nombre, descripcion, portada, fecha_ini, fecha_fin) VALUES ('" . $next_slide . "','" . $_POST['nombre'] . "','" . $_POST['descripcion'] . "','" . $photo_name . "','" . $_POST['fecha_ini'] . "','" . $_POST['fecha_fin'] . "')";
    $Result1 = mysql_query($insertSQL, $elencuentro) or die(mysql_error());
    header("Location: index.php");
}
include '../header.php';
Beispiel #21
0
        $imageCount = count($result, 0);
        $result = DBAccess::getPictureByPictureIcon($icon);
        $iconCount = count($result, 0);
        if (!($imageCount == 0 && $iconCount == 0)) {
            $error = true;
            $classPicErrorText = "Filename already exists";
        } else {
            $classPicErrorText = "PASS";
        }
    }
    if (!$error) {
        move_uploaded_file($_FILES["file"]["tmp_name"], "../Images/" . $image);
        //move_uploaded_file($_FILES["file"]["tmp_name"], "../Images/" . $icon);
        $imageObj = new SimpleImage();
        $imageObj->load("../Images/" . $image);
        $imageObj->resizeToWidth(134);
        $imageObj->save("../Images/" . $icon);
        echo "DBAccess::insertPicture(" . $photoName . ", " . $photoDescription . ", " . $photoDate . ", " . $icon . ", " . $image . ", " . $classID . ", " . $userIDD . ", " . $eventID . ", TRUE);";
        $result = DBAccess::insertPicture($photoName, $photoDescription, $photoDate, $icon, $image, $classID, $userIDD, $eventID, TRUE);
        $value = $result[0]['Error'];
        if ($value > 0) {
            header("Location: ../gallery.php");
        } else {
            $feedBack = "An error occured" . $value;
        }
    } else {
        $feedBack = "Invalid input detected ";
    }
}
//Get list of users
$userResult = DBAccess::getAllUsers();
Beispiel #22
0
 /**
  * Save the passed file.
  * If ID is set the current file becomes updated if write access for current user
  * If no ID is passed a new file becomes created
  * @param $file
  *          The file to be stored
  * @param null $id
  *          The ID of the file
  * @param string $title
  *          The new title of the file. Only available when initializing a new file.
  *          Use setFileAttributes to update an existing file
  * @param int $folder
  *          The ID of the folder where the file should be registered
  * @echo int
  *          The final ID of the file
  */
 static function setFile($file, $id = null, $title = '', $folder = null)
 {
     $mysqli = System::connect('cloud');
     $current_user = System::getCurrentUser();
     if ($folder == null) {
         $folder = 1;
     }
     if (is_array($file)) {
         $image_type = exif_imagetype($file['tmp_name']);
         $type = $mysqli->real_escape_string($file['type']);
         $filename = Util::get_filename_for($file['name']);
     } else {
         list($width, $height, $image_type, $attr) = getimagesize($file);
         $type = image_type_to_mime_type($image_type);
         $filename = basename($file);
         $arr_filename = explode(".", $filename);
         if (count($arr_filename) > 0) {
             $filename = $arr_filename[0];
         }
         $filename = Util::get_filename_for($filename . image_type_to_extension($image_type));
         if ($title == '') {
             $title = $filename;
         }
     }
     if ($id == null || $id == '') {
         // new file
         // Register file in DB, set rights and create folder
         $id = Util::prepareForNewFile($title, $type, $filename, $folder, $current_user->id);
     } else {
         // update existing file
         // Check write access
         if (!Util::has_write_access($id, 'file')) {
             header('HTTP/1.0 403 Forbidden');
             echo new ErrorMessage(403, 'Forbidden', 'You do not have write access to the requested file-ID.');
             die;
         }
         // Delete actual files
         $existing_files = glob(Util::$uploadDir . "/{$id}/*");
         // get all file names
         foreach ($existing_files as $deletable_file) {
             // iterate files
             if (is_file($deletable_file)) {
                 unlink($deletable_file);
             }
             // delete file
         }
     }
     // Save original file
     if (is_array($file)) {
         $success = move_uploaded_file($file['tmp_name'], Util::$uploadDir . "/{$id}/{$filename}");
     } else {
         $success = copy($file, Util::$uploadDir . "/{$id}/{$filename}");
     }
     // save scaled versions if it is an image
     // $image_type is false if this is not an image
     if ($image_type && ($image_type == IMAGETYPE_JPEG || $image_type == IMAGETYPE_GIF || $image_type == IMAGETYPE_PNG)) {
         include_once "lib/SimpleImage.php";
         $image = new SimpleImage();
         $image->load(Util::$uploadDir . "/{$id}/{$filename}");
         $image->resizeToWidth(400);
         $image->save(Util::$uploadDir . "/{$id}/400width_{$filename}");
         $image->resizeToWidth(100);
         $image->save(Util::$uploadDir . "/{$id}/100width_{$filename}");
     }
     if ($success) {
         header('HTTP/1.0 200 OK');
         echo json_encode(array('id' => $id));
     } else {
         header('HTTP/1.0 400 Internal Server Error');
         echo new ErrorMessage(400, 'Internal Server Error', 'Your uploaded file could not be saved.');
     }
     // allow hot-link for public files
     Util::set_chmod($id, Util::has_read_access($id, 'file', User::get_default_user()));
 }
Beispiel #23
0
     if ($file_ext == 'JPG' || $file_ext == 'jpg') {
         $files['foto'][] = $curr_file;
     } else {
     }
 }
 sort($files['foto']);
 $num_foto = count($files['foto']);
 print 'В директории ' . $serv . $db_dir . $updir . '/ ' . $num_foto . ' фотографий<br>';
 print 'GPX-файл: ' . $files['gpx'] . '<br>';
 //---RESULT: array: $files [gpx]=>...gpx, ['foto']=>[0]some1.jpg,[1]=>some2.jpg ---
 //MODULE:---creation preview files---
 mkdir($db_dir . $updir . '/prev/');
 foreach ($files['foto'] as $n_foto => $foto) {
     $image = new SimpleImage();
     $image->load($db_dir . $updir . '/' . $foto);
     $image->resizeToWidth($resw);
     $image->save($db_dir . $updir . '/prev/' . $foto);
 }
 //---RESULT: new directory /prev with preview of photo files ---
 //MODULE:---exif export module---
 //create table of images with data from exif
 $exif = array();
 $nexif = 0;
 foreach ($files['foto'] as $jk => $jv) {
     $jfile = $db_dir . $updir . '/' . $jv;
     $ex = exif_read_data($jfile);
     $exif[$nexif]['name'] = $ex[FileName];
     $exif[$nexif]['datetime'] = $ex[DateTimeOriginal];
     $exif[$nexif]['UTS'] = strtotime($ex[DateTimeOriginal]);
     $nexif = $nexif + 1;
 }
function get_thumb2($path, $width = 140)
{
    // $img_path= (Dev) ? Croppa::url('ahmed-badawy/public/'.$path, $width, $height)
    //                                         : Croppa::url('site/public/'.$path, $width, $height);
    // return "http:$img_path";
    // $path = preg_replace("/.jpg/","-140x140.jpg",$path);
    // return public_dir.$path;
    die;
    $path_array = explode(".", $path);
    $extention = array_pop($path_array);
    $path = implode(".", $path_array);
    $save_path = real_imgs_dir . $path . '.' . $extention;
    $resized_save_path = $save_path . "_resized-Width-{$width}.jpg";
    $get_img_path = imgs_dir . $path . '.' . $extention . "_resized-Width-{$width}.jpg";
    $old_path = $path . "-140x140.jpg";
    if (file_exists($resized_save_path)) {
        return $get_img_path;
    } elseif (file_exists(real_imgs_dir . $old_path)) {
        return imgs_dir . $old_path;
    } elseif (!file_exists($save_path)) {
        die("image ({$path}) -> doesn't exist...");
    } else {
        $image = new \SimpleImage();
        $image->load($save_path);
        $image->resizeToWidth($width);
        // $image->resize($width,$height);
        $image->save($resized_save_path);
    }
    return $get_img_path;
}
Beispiel #25
0
 public function update_profile()
 {
     $data = array("country" => $this->input->post('country'), "province" => $this->input->post('province'), "city" => $this->input->post('city'), "address" => $this->input->post('address'), "postal" => $this->input->post('postal'), "id_card_number" => $this->input->post('id_card_number'), "phone" => $this->input->post('phone'), "im" => $this->input->post('im'), "bank_name" => $this->input->post('bank_name'), "bank_branch" => $this->input->post('bank_branch'), "bank_acc_num" => $this->input->post('bank_acc_num'), "bank_acc_name" => $this->input->post('bank_acc_name'), "fb_username" => $this->input->post('fb_username'), "fb_link" => $this->input->post('fb_link'), "last_update" => date('Y-m-d H:i:s'));
     if ($this->input->post('pin') != '') {
         $data["pin"] = md5($this->input->post('pin'));
     }
     if (isset($_POST['verify']) and $_FILES['ktp_file']['tmp_name'] == '') {
         if (!is_file("media/img/member_id/id_card_" . $this->session->userdata('id_member') . ".jpg")) {
             $this->m_member->update_member($this->session->userdata('id_member'), $data);
             $this->session->set_flashdata('error', "KTP harus di upload untuk proses verifikasi");
             redirect("member/account_verification");
         }
     }
     $this->m_member->update_member($this->session->userdata('id_member'), $data);
     if ($_FILES['ktp_file']['tmp_name'] != '') {
         $path = "media/img/member_id/";
         $tmp = $_FILES['ktp_file']['tmp_name'];
         $size = getimagesize($tmp);
         $img_name = "id_card_" . $this->session->userdata('id_member') . ".jpg";
         $image = new SimpleImage();
         $image->load($tmp);
         if ($size[0] > 535) {
             $image->resizeToWidth(535);
         }
         $image->save($path . $img_name);
     }
     if (!isset($_POST['verify'])) {
         redirect("member/my_profile");
     } else {
         $this->_is_valid();
         redirect("member/account_verification");
     }
 }
Beispiel #26
0
 function upload()
 {
     if (!isset($_FILES['upload'])) {
         $this->directrender('S3/S3');
         return;
     }
     global $params;
     // Params to vars
     $client_id = '1b5cc674ae2f335';
     // Validations
     $this->startValidations();
     $this->validate($_FILES['upload']['error'] !== 1, $err, 'size too large');
     $this->validate($_FILES['upload']['error'] === 0, $err, 'upload error');
     $this->validate($_FILES['upload']['size'] <= 10 * 1024 * 1024, $err, 'size too large');
     // Code
     if ($this->isValid()) {
         $fname = $_FILES['upload']['tmp_name'];
         require_once $GLOBALS['dirpre'] . 'includes/S3/SimpleImage.php';
         $image = new SimpleImage();
         $this->validate($image->load($fname), $err, 'invalid image type');
         if ($this->isValid()) {
             if ($image->getHeight() < $image->getWidth()) {
                 if ($image->getHeight() > 1000) {
                     $image->resizeToHeight(1000);
                 }
             } else {
                 if ($image->getWidth() > 1000) {
                     $image->resizeToWidth(1000);
                 }
             }
             $image->save($fname);
             function getMIME($fname)
             {
                 $finfo = finfo_open(FILEINFO_MIME_TYPE);
                 $mime = finfo_file($finfo, $fname);
                 finfo_close($finfo);
                 return $mime;
             }
             $filetype = explode('/', getMIME($fname));
             $valid_formats = array("jpg", "png", "gif", "jpeg");
             $this->validate($filetype[0] === 'image' and in_array($filetype[1], $valid_formats), $err, 'invalid image type');
             if ($this->isValid()) {
                 require_once $GLOBALS['dirpre'] . 'includes/S3/s3_config.php';
                 //Rename image name.
                 $actual_image_name = time() . "." . $filetype[1];
                 if (isset($_GET['name']) && $_GET['name'] == 'bannerphoto') {
                     $this->validate($image->getWidth() >= 1000, $err, 'Please upload a banner image at least 1000px wide.');
                 }
                 $this->validate($s3->putObjectFile($fname, $bucket, $actual_image_name, S3::ACL_PUBLIC_READ), $err, 'upload failed');
                 if ($this->isValid()) {
                     $reply = "https://{$bucket}.s3.amazonaws.com/{$actual_image_name}";
                     $this->success('image successfully uploaded');
                     $this->directrender('S3/S3', array('reply' => "up(\"{$reply}\");"));
                     return;
                 }
             }
         }
     }
     $this->error($err);
     $this->directrender('S3/S3');
 }
Beispiel #27
0
<?php

echo "Este exemplo redimensiona somente a largura, presevando a proporcao<br /><br />";
include 'core/class.simpleImage.php';
$image = new SimpleImage();
$image->load('example.jpg');
$image->resizeToWidth(250);
$image->save('galeria/example2.jpg');
echo "<img src='galeria/example2.jpg'>";
Beispiel #28
0
if (!in_array($fileExt, $typesArray)) {
    die("error_filetype_not_allowed");
}
$relative_folder_path = "files/" . gmdate("Y-m") . "/images";
$absolute_folder_path = str_replace('//', '/', "{$_SESSION["root_path"]}/{$relative_folder_path}");
if (!is_dir($absolute_folder_path)) {
    mkdir($absolute_folder_path, 0755, true);
}
$random_fileNumber = gmdate("U_") . rand(0, 1000);
$filename = "{$random_fileNumber}__{$user->username}___{$fileParts['basename']}";
$file_absolute_path_fullsize = "{$absolute_folder_path}/{$filename}";
$file_absolute_path_thumbnail = "{$absolute_folder_path}/tn_{$filename}";
$file_relative_path_fullsize = "{$relative_folder_path}/{$filename}";
$file_relative_path_thumbnail = "{$relative_folder_path}/tn_{$filename}";
copy($_FILES['Filedata']['tmp_name'], $file_absolute_path_thumbnail);
move_uploaded_file($_FILES['Filedata']['tmp_name'], $file_absolute_path_fullsize);
$img = new SimpleImage();
$img->load($file_absolute_path_thumbnail);
$filetype = $img->image_type;
if ($img->getWidth() > $img->getHeight()) {
    $img->resizeToWidth(150);
} else {
    $img->resizeToHeight(150);
}
$img->save($file_absolute_path_thumbnail, $filetype);
$group = $_REQUEST["group"];
$created = gmdate("Y-m-d H:i:s");
if (!mysql_query("INSERT INTO `images_general` (`type`,`size`,`file_location`,`file_thumbnail`,`file_name`,`group`,`author`,`created`) VALUES ('{$fileExt}','" . filesize($_FILES['Filedata']['tmp_name']) . "','{$file_relative_path_fullsize}','{$file_relative_path_thumbnail}','{$fileParts['basename']}','{$group}','{$user->username}','{$created}')")) {
    die("database_error");
}
die("done");
Beispiel #29
0
 function check_size_and_rotation($pathname)
 {
     require_once mnminclude . "simpleimage.php";
     $original = $pathname;
     $tmp = "{$pathname}.tmp";
     $max_size = 2048;
     $image = new SimpleImage();
     if ($image->rotate_exif($pathname)) {
         if ($image->save($tmp)) {
             $pathname = $tmp;
             clearstatcache();
         }
     }
     if (filesize($pathname) > 1024 * 1024) {
         // Bigger than 1 MB
         if ($image->load($pathname) && ($image->getWidth() > $max_size || $image->getHeight() > $max_size)) {
             if ($image->getWidth() > $image->getHeight) {
                 $image->resizeToWidth($max_size);
             } else {
                 $image->resizeToHeight($max_size);
             }
             if ($image->save($tmp)) {
                 $pathname = $tmp;
                 clearstatcache();
             }
         }
     }
     if ($pathname != $original && file_exists($pathname)) {
         if (!@rename($pathname, $original)) {
             syslog(LOG_INFO, "Error renaming file {$pathname} -> {$original}");
             @unlink($pathname);
         }
     }
     $this->size = filesize($original);
     @chmod($original, 0777);
     return true;
 }
 private function savePhoto(AnnouncementPro $announce, $target, $file)
 {
     if ($file['error'] == 0) {
         $simpleImage = new SimpleImage();
         $thumbnailsSimpleImage = new SimpleImage();
         $simpleImage->load($file['tmp_name']);
         $thumbnailsSimpleImage->load($file['tmp_name']);
         if (!is_null($simpleImage->image_type)) {
             $height = $simpleImage->getHeight();
             $width = $simpleImage->getWidth();
             //Redimensionnement de l'image original en format modéré
             if ($height > 1200 || $width > 1600) {
                 if ($height > $width) {
                     $simpleImage->resizeToHeight(1200);
                 } else {
                     $simpleImage->resizeToWidth(1600);
                 }
             }
             //Redimensionnement de l'image original en miniature
             if ($height > $width) {
                 $thumbnailsSimpleImage->resizeToHeight(300);
             } else {
                 $thumbnailsSimpleImage->resizeToWidth(300);
             }
             $filename = $target . '-' . time() . '.jpg';
             $thumbnails = AnnouncementPro::THUMBNAILS_PREFIX . $filename;
             $simpleImage->save($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $filename);
             $thumbnailsSimpleImage->save($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $thumbnails);
             $getMethod = 'get' . $target;
             $setMethod = 'set' . $target;
             if ($announce->{$getMethod}() != AnnouncementPro::IMAGE_DEFAULT && $announce->{$getMethod}() != '') {
                 unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->{$getMethod}());
                 unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->{$getMethod}());
             }
             $announce->{$setMethod}($filename);
         }
     }
 }