RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v retrieving revision 1.135 diff -u -r1.135 image.module --- image.module 25 Nov 2004 01:38:17 -0000 1.135 +++ image.module 6 Dec 2004 20:47:51 -0000 @@ -110,11 +110,14 @@ $output .= form_textfield(t("List of valid resolutions"), "image_default_resolutions", variable_get("image_default_resolutions", "640x480,800x600,1024x768,1600x1200"), 60, 255, t("This is a list of resolutions that the image can be displayed at as well as its original size")); // build array of resolutions + $resolutions = array(); foreach (explode(",", variable_get("image_default_resolutions", "640x480,800x600,1024x768,1600x1200")) as $v) { - $resolution[$v] = $v; + if ($v) { + $resolution[$v] = $v; + } } - $output .= form_select(t("Default image display resolution"), "image_default_resolution", variable_get("image_default_resolution", "640x480"), $resolution, t("Select a resolution that you wish the image to be displayed at if no resolution is specified.")); - $output .= form_select(t("Specify resolutions that will be generated at time of editing."), "image_static_resolution", variable_get("image_static_resolution", array("640x480")), $resolution, t("This is a list of the resolutions that will be created at the time of editing. Ones not selected will generated and saved the first time they are displayed."), array("size" => "4"), 1); + $output .= form_select(t("Default image display resolution"), "image_default_resolution", variable_get("image_default_resolution", "640x480"), array_merge(array("original"=>t('original')), $resolution), t("Select a resolution that you wish the image to be displayed at if no resolution is specified.")); + $output .= form_select(t("Specify resolutions that will be generated at time of editing."), "image_static_resolution", variable_get("image_static_resolution", array('')), array_merge(array(""=>t("")), $resolution), t("This is a list of the resolutions that will be created at the time of editing. Ones not selected will generated and saved the first time they are displayed."), array("size" => "4"), 1); $output .= form_textfield(t("Default thumbnail resolution"), "image_default_thumb_size", variable_get("image_default_thumb_size", "100"), 10, 255, t("Default size of thumbnails: format will be the same as original image. Use just one dimension, and put a \"x\" to specify height. Examples: \"100\" for width of 100; \"x200\" for height of 200.")); @@ -216,9 +219,11 @@ if ($type == "node" && $node->type == "image") { foreach(explode(",", variable_get("image_default_resolutions", "640x480,800x600,1024x768,1600x1200")) as $v) { - $max_dim = split("x", $v); - if ($node->width > $max_dim[0] || $node->height > $max_dim[1]) { - $links[] = l($v, "node/$node->nid", array(), "res=$v"); + if ($v) { + $max_dim = split("x", $v); + if ($node->width > $max_dim[0] || $node->height > $max_dim[1]) { + $links[] = l($v, "node/$node->nid", array(), "res=$v"); + } } } $links[] = l(t("original image"), "node/$node->nid", array(), "res=original"); @@ -620,8 +626,8 @@ // Build additional static images. // Add to image_list any default resolutions that are missing. - foreach (variable_get('image_static_resolution', array('640x480')) as $v) { - if (!array_key_exists($v, $node->image_list)) { + foreach (variable_get('image_static_resolution', array('')) as $v) { + if ($v && !array_key_exists($v, $node->image_list)) { $node->image_list[$v] = ''; } }