diff --git a/3.0/modules/image_optimizer/controllers/admin_image_optimizer.php b/3.0/modules/image_optimizer/controllers/admin_image_optimizer.php
new file mode 100644
index 00000000..aad840a3
--- /dev/null
+++ b/3.0/modules/image_optimizer/controllers/admin_image_optimizer.php
@@ -0,0 +1,163 @@
+_get_admin_form();
+ $this->_print_screen($form);
+ }
+
+ public function save() {
+ access::verify_csrf();
+ $form = $this->_get_admin_form();
+ if ($form->validate()) {
+ foreach (array('jpg', 'png', 'gif') as $type) {
+ module::set_var("image_optimizer", "path_".$type, $form->paths->{"path_".$type}->value);
+ module::set_var("image_optimizer", "optlevel_thumb_".$type, $form->thumb->{"optlevel_thumb_".$type}->value);
+ module::set_var("image_optimizer", "optlevel_resize_".$type, $form->resize->{"optlevel_resize_".$type}->value);
+ }
+ module::set_var("image_optimizer", "rotate_jpg", ($form->rotate->rotate_jpg->value == 1));
+ foreach (array('thumb', 'resize') as $target) {
+ module::set_var("image_optimizer", "convert_".$target."_gif", $form->$target->{"convert_".$target."_gif"}->value);
+ module::set_var("image_optimizer", "convert_".$target."_png", $form->$target->{"convert_".$target."_png"}->value);
+ module::set_var("image_optimizer", "metastrip_".$target, ($form->$target->{"metastrip_".$target}->value == 1));
+ module::set_var("image_optimizer", "progressive_".$target, ($form->$target->{"progressive_".$target}->value == 1));
+ // deal with enable changes
+ $enable_old = module::get_var("image_optimizer", "enable_".$target);
+ $enable_new = ($form->$target->{"enable_".$target}->value == 1);
+ if ($enable_new && !$enable_old) {
+ image_optimizer::add_image_optimizer_rule($target);
+ module::set_var("image_optimizer", "enable_".$target, true);
+ } elseif (!$enable_new && $enable_old) {
+ image_optimizer::remove_image_optimizer_rule($target);
+ module::set_var("image_optimizer", "enable_".$target, false);
+ }
+ // deal with update mode changes
+ $update_mode_old = module::get_var("image_optimizer", "update_mode_".$target);
+ $update_mode_new = ($form->$target->{"update_mode_".$target}->value == 1);
+ if ($update_mode_new && !$update_mode_old) {
+ image_optimizer::activate_update_mode($target);
+ } elseif (!$update_mode_new && $update_mode_old) {
+ image_optimizer::deactivate_update_mode($target);
+ }
+ // dirty images if needed
+ if ($form->$target->{"rebuild_".$target}->value == 1) {
+ image_optimizer::dirty($target);
+ }
+ }
+ // all done; redirect with message
+ message::success(t("Image optimizer settings updated successfully"));
+ url::redirect("admin/image_optimizer");
+ }
+ // not valid - print screen from existing form
+ $this->_print_screen($form);
+ }
+
+ private function _print_screen($form) {
+ // this part is a bit of a hack, but Forge doesn't seem to allow set_attr() for groups.
+ $form = $form->render();
+ $form = preg_replace("/