diff --git a/ext/admin/main.php b/ext/admin/main.php
index b6e7bfb9..f00ca883 100644
--- a/ext/admin/main.php
+++ b/ext/admin/main.php
@@ -197,26 +197,21 @@ class AdminPage extends Extension {
 	private function download_all_images() {
 		global $database, $page;
 
-		$zip = new ZipArchive;
-		$images = $database->get_all("SELECT * FROM images");
+		$images = $database->get_all("SELECT hash, ext FROM images");
 		$filename = data_path('imgdump-'.date('Ymd').'.zip');
 
-		if($zip->open($filename, 1 ? ZIPARCHIVE::OVERWRITE:ZIPARCHIVE::CREATE) === TRUE){
+		$zip = new ZipArchive;
+		if($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) === TRUE){
 			foreach($images as $img){
-				$hash = $img["hash"];
-				preg_match("^[A-Za-z0-9]{2}^", $hash, $matches);
-				$img_loc = "images/".$matches[0]."/".$hash;
-				if(file_exists($img_loc)){
-					$zip->addFile($img_loc, $hash.".".$img["ext"]);
-				}
-
+				$img_loc = warehouse_path("images", $img["hash"], FALSE);
+				$zip->addFile($img_loc, $img["hash"].".".$img["ext"]);
 			}
 			$zip->close();
 		}
 
 		$page->set_mode("redirect");
-		$page->set_redirect(make_link($filename)); //Fairly sure there is better way to do this..
-		//TODO: Delete file after downloaded?
+		$page->set_redirect(make_link($filename)); //TODO: Delete file after downloaded?
+
 		return false;  // we do want a redirect, but a manual one
 	}
 
diff --git a/ext/admin/theme.php b/ext/admin/theme.php
index f95b34c4..64c18d2f 100644
--- a/ext/admin/theme.php
+++ b/ext/admin/theme.php
@@ -39,7 +39,7 @@ class AdminPageTheme extends Themelet {
 		$html = "";
 		$html .= $this->button("All tags to lowercase", "lowercase_all_tags", true);
 		$html .= $this->button("Recount tag use", "recount_tag_use", false);
-		$html .= $this->button("Download all images", "image_dump", false);
+		$html .= $this->button("Download all images", "download_all_images", false);
         $html .= $this->button("Download database contents", "database_dump", false);
 		if($database->get_driver_name() == "mysql")
 			$html .= $this->button("Reset image IDs", "reset_image_ids", true);