示例#1
0
         $image_type = 'gif';
         break;
 }
 $image_data = array('filename' => $image_file->realname, 'image_album_id' => $album_data['album_id'], 'image_album_name' => $album_data['album_name'], 'image_name' => str_replace('{NUM}', $loop, request_var('image_name', '', true)), 'image_desc' => str_replace('{NUM}', $loop, request_var('message', '', true)), 'image_time' => time() + $loop, 'image_contest' => $album_data['album_contest'] ? phpbb_gallery_image::IN_CONTEST : phpbb_gallery_image::NO_CONTEST, 'thumbnail' => '', 'username' => request_var('username', $user->data['username']));
 $image_data['image_name'] = request_var('filename', '') == 'filename' || $image_data['image_name'] == '' ? str_replace("_", " ", utf8_substr($image_file->uploadname, 0, strrpos($image_file->uploadname, '.'))) : $image_data['image_name'];
 if (!$image_data['image_name']) {
     trigger_error('MISSING_IMAGE_NAME');
 }
 if (!$user->data['is_registered'] && $image_data['username']) {
     if (validate_username($image_data['username'])) {
         trigger_error('INVALID_USERNAME');
     }
 }
 $image_tools = new phpbb_gallery_image_file();
 $image_tools->set_image_options(phpbb_gallery_config::get('max_filesize'), phpbb_gallery_config::get('max_height'), phpbb_gallery_config::get('max_width'));
 $image_tools->set_image_data($image_file->destination_file, $image_data['image_name'], $image_file->filesize);
 // Read exif data from file
 $exif = new phpbb_gallery_exif($image_file->destination_file);
 $exif->read();
 $image_data['image_exif_data'] = $exif->serialized;
 $image_data['image_has_exif'] = $exif->status;
 unset($exif);
 /// Rotate the image
 if (phpbb_gallery_config::get('allow_rotate')) {
     $image_tools->rotate_image($rotate[$i], phpbb_gallery_config::get('allow_resize'));
     if ($image_tools->rotated) {
         $image_file->height = $image_tools->image_size['height'];
         $image_file->width = $image_tools->image_size['width'];
     }
 }
 // Resize overside images
示例#2
0
        }
        break;
}
$image_source = $image_source_path . $image_data['image_filename'];
// There was a reason to not display the image, so we send an error-image
if ($image_error) {
    $image_data['image_filename'] = $user->data['user_lang'] . '_' . $image_error;
    if (!file_exists($image_source_path . $image_data['image_filename'])) {
        $image_data['image_filename'] = $image_error;
    }
    $image_source = $image_source_path . $image_data['image_filename'];
    $possible_watermark = false;
}
$image_tools = new phpbb_gallery_image_file(phpbb_gallery_config::get('gdlib_version'));
$image_tools->set_image_options(phpbb_gallery_config::get('max_filesize'), phpbb_gallery_config::get('max_height'), phpbb_gallery_config::get('max_width'));
$image_tools->set_image_data($image_source, $image_data['image_name']);
// Generate the sourcefile, if it's missing
if ($mode == 'medium' || $mode == 'thumbnail') {
    $filesize_var = '';
    if ($mode == 'thumbnail') {
        $resize_width = phpbb_gallery_config::get('thumbnail_width');
        $resize_height = phpbb_gallery_config::get('thumbnail_height');
    } else {
        $resize_width = phpbb_gallery_config::get('medium_width');
        $resize_height = phpbb_gallery_config::get('medium_height');
    }
    if (!file_exists($image_source)) {
        $image_tools->set_image_data(phpbb_gallery_url::path('upload') . $image_data['image_filename']);
        $image_tools->read_image(true);
        $image_size['file'] = $image_tools->image_size['file'];
        $image_size['width'] = $image_tools->image_size['width'];