예제 #1
0
 $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
 if ($image_file->width > phpbb_gallery_config::get('max_width') || $image_file->height > phpbb_gallery_config::get('max_height')) {
     if (phpbb_gallery_config::get('allow_resize')) {
         $image_tools->resize_image(phpbb_gallery_config::get('max_width'), phpbb_gallery_config::get('max_height'));