/** * Delete an image completly. * * @param array $images Array with the image_id(s) * @param array $filenames Array with filenames for the image_ids. If a filename is missing it's queried from the database. * Format: $image_id => $filename */ public static function delete_images($images, $filenames = array()) { //@todo: phpbb_gallery_comment_base::delete_images($images); //@todo: phpbb_gallery_report_base::delete_images($images); //@todo: phpbb_gallery_favorite::delete_images($images); //@todo: phpbb_gallery_watch::delete_images($images); // Delete the files from the disc... $need_filenames = array(); foreach ($images as $image) { if (!isset($filenames[$image])) { $need_filenames[] = $image; } } $filenames = array_merge($filenames, self::get_filenames($need_filenames)); phpbb_gallery_image_file::delete($filenames); // Delete the ratings... phpbb_gallery_image_rating::delete_ratings($images); $sql = 'DELETE FROM ' . GALLERY_IMAGES_TABLE . ' WHERE ' . $db->sql_in_set('image_id', $images); $db->sql_query($sql); return true; }
case 'image/gif': case 'image/giff': $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']; }
WHERE image_id = ' . $image_id; $db->sql_query($sql); } 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);