Beispiel #1
0
 function saveFile($file, $path, $folder)
 {
     global $s, $ThumbnailImage;
     $directorio = FilesDir . $folder . "/";
     //echo $directorio;
     if (is_uploaded_file($path)) {
         if ($file->filename && is_file($directorio . $file->filename)) {
             unlink($directorio . $file->filename);
         }
         $file->filename = $file->type . time() . "." . substr(strrchr($file->filename, "."), 1);
         mkdir_recursive($directorio, 0755);
         $ti = new ThumbnailImage();
         $ti->src_file = $path;
         $ti->dest_type = THUMB_JPEG;
         $ti->dest_file = $directorio . 'thum150-' . $file->filename;
         $ti->max_width = 150;
         $ti->max_height = 150;
         $ti->Output();
         chmod($ti->dest_file, 0755);
         $ti->dest_file = $directorio . 'thum300-' . $file->filename;
         $ti->max_width = 300;
         $ti->max_height = 300;
         $ti->Output();
         chmod($ti->dest_file, 0755);
         $ti->dest_file = $directorio . 'thum800-' . $file->filename;
         $ti->max_width = 800;
         $ti->max_height = 800;
         $ti->Output();
         chmod($ti->dest_file, 0755);
         return $file->filename;
     }
 }
Beispiel #2
0
     * This is the only part that requires actual apache access to the images directory
     * Difficult to resize an image if apache cannot write the image anywhere
     */
    $ti = new ThumbnailImage();
    $ti->src_file = $_FILES['logo']['tmp_name'];
    $ti->dest_type = THUMB_JPEG;
    $ti->dest_file = $mosConfig_absolute_path . '/images/jtips/' . $filename_100;
    $ti->max_width = 100;
    $ti->max_height = 100;
    $ti->Output();
    $ti = null;
    $ti = new ThumbnailImage();
    $ti->src_file = $_FILES['logo']['tmp_name'];
    $ti->dest_type = THUMB_JPEG;
    $ti->dest_file = $mosConfig_absolute_path . '/images/jtips/' . $filename_25;
    $ti->max_width = 25;
    $ti->max_height = 25;
    $ti->Output();
    $jTeam->logo = 'images/jtips/' . $filename;
} else {
    if (jTipsGetParam($_REQUEST, 'remove_logo', 0) == 1) {
        $jTeam->logo = '';
    }
}
if (!$jTeam->save()) {
    $message = 'Save Failed!';
} else {
    $message = 'Team Saved!';
}
//show_teams($option);
mosRedirect('index2.php?option=com_jtips&task=list&module=Teams', $message);