Esempio n. 1
0
                                    $db->sql_query($sql);
                                }
                            }
                            $rotate = request_var('rotate', 0);
                            if (phpbb_gallery_config::get('allow_rotate') && $rotate > 0 && $rotate % 90 == 0) {
                                $image_tools = new phpbb_gallery_image_tools();
                                $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(phpbb_gallery_url::path('upload') . $image_data['image_filename']);
                                if ($image_data['image_has_exif'] != phpbb_gallery_constants::EXIF_UNAVAILABLE && $image_data['image_has_exif'] != phpbb_gallery_constants::EXIF_DBSAVED) {
                                    // Store exif-data to database if there are any and we didn't already do that.
                                    $image_tools->read_exif_data();
                                    $sql_ary['image_exif_data'] = $image_tools->exif_data_serialized;
                                    $sql_ary['image_has_exif'] = $image_tools->exif_data_exist;
                                }
                                // Rotate the image
                                $image_tools->rotate_image($rotate, phpbb_gallery_config::get('allow_resize'));
                                if ($image_tools->rotated) {
                                    $image_tools->write_image($image_tools->image_source, phpbb_gallery_config::get('jpg_quality'), true);
                                }
                                @unlink(phpbb_gallery_url::path('cache') . $image_data['image_filename']);
                                @unlink(phpbb_gallery_url::path('medium') . $image_data['image_filename']);
                            }
                            $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . ' 
						SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
						WHERE image_id = ' . $image_id;
                            $db->sql_query($sql);
                            if ($move_to_personal && $personal_album_id) {
                                phpbb_gallery_album::update_info($album_data['album_id']);
                                phpbb_gallery_album::update_info($personal_album_id);
                            }
                            if ($user->data['user_id'] != $image_data['image_user_id']) {