<form method="post">
  <p>
    <input type="url" placeholder="<?php echo $defUrl; ?>" value="<?php echo $defUrl; ?>" name="url"/>
  </p>
  <p>
    <label>Size</label>
    <select name="s">
      <?php
      foreach ($GLOBALS['config']['thumbSize'] as $key => $value) {
        if ($value === $width) {
          echo '<option value="', $key, '" selected="selected">', $value, '</option>';
        } else {
          echo '<option value="', $key, '">', $value, '</option>';
        }
      }
      ?>
    </select>
  </p>
  <p>
    <label>Force refresh</label>
    <input type="checkbox" value="1" name="fr" />
  </p>
  <p>
    <input type="hidden" name="token" value="<?php echo genToken(); ?>" />
    <input type="submit" value="Generate"/>
  </p>
  <p class="info">
    <a href="http://forge.leslibres.org/projects/soshot">Homepage</a> <a href="http://knah-tsaeb.org/contact-page/">Contact</a>
  </p>
</form>
<?php
if (!empty($success)) {
  echo '<div id="result">';
  echo '<h3>This image will be removed in ', $GLOBALS['config']['expireCache'], 'h</h3>';
  echo '<img src="data:image/png;base64,',base64_encode(file_get_contents($success['thumb'])), '"/>';
  echo '<p><label>Thumbshot</label><input type="text" value="http://', $_SERVER['SERVER_NAME'], '/', $success['thumb'], '" onclick="this.select()"/>';
  if ($GLOBALS['config']['activeFullSize'] === true) {
    echo '<p><label>1280x1024</label><input type="text" value="http://', $_SERVER['SERVER_NAME'], '/', $success['normal'], '" onclick="this.select()"/></p>';
  }
  if ($GLOBALS['config']['activeComplete'] === true) {
    echo '<p><label>Complete</label><input type="text" value="http://', $_SERVER['SERVER_NAME'], '/', $success['complete'], '" onclick="this.select()"/></p>';
  }
  echo '</div>';
}
