/**
  * Get HTML to display the sized image and its url at the top of the given form
  * @param object disco form
  * @return string HTML to display
  */
 function pre_show_disco(&$disco)
 {
     if ($disco->has_errors()) {
         return '';
     }
     if ($image = $this->_get_image()) {
         $unsized_width = $image->get_value('width');
         $unsized_height = $image->get_value('height');
         $sized_width = $disco->get_value('width');
         $sized_height = $disco->get_value('height');
         if (empty($sized_width) && empty($sized_height) || $unsized_width == $sized_width && $unsized_height == $sized_height) {
             $showing_normal_size = true;
             $url = reason_get_image_url($image);
         } else {
             $showing_normal_size = false;
             $rsi = new reasonSizedImage();
             $server_path = REASON_SIZED_IMAGE_CUSTOM_DIR;
             $web_path = REASON_SIZED_IMAGE_CUSTOM_DIR_WEB_PATH;
             $rsi->set_paths($server_path, $web_path);
             $rsi->set_id($image->id());
             if (!empty($sized_width)) {
                 $rsi->set_width($sized_width);
             }
             if (!empty($sized_height)) {
                 $rsi->set_height($sized_height);
             }
             if ($disco->get_value('crop')) {
                 $rsi->set_crop_style($disco->get_value('crop'));
             }
             $url = $rsi->get_url();
         }
         $ret = '<div class="preview">' . "\n";
         $ret .= '<div class="image"><img src="' . htmlspecialchars($url) . '" alt="Image sized to ' . ($sized_width ? $sized_width : 'auto') . ' by ' . ($sized_height ? $sized_height : 'auto') . ' pixels" /></div>' . "\n";
         if ($showing_normal_size) {
             $ret .= '<div class="normalSizeNotice smallText">(This is the standard size of this image.)</div>' . "\n";
         } else {
             $ret .= '<div class="url"><div class="label"><p>To use this image at this size:</p><ol><li>copy this web address</li><li>paste it into the "image at web address" tab in the "insert image" dialog box.</li></ol></div><input type="text" value="' . htmlspecialchars($url) . '" size="50" /></div>' . "\n";
         }
         $ret .= '</div>' . "\n";
         if (!$showing_normal_size) {
             $ret .= '<h4 class="tryAgainHeading">Try another size</h4>' . "\n";
         }
         return $ret;
     }
 }