Beispiel #1
0
function imageTag($file)
{
    // if Image was specified ...
    if (strlen($file) > 0) {
        // ... initialize context
        if (($bytes = filesize(IMAGE_DIR . $file)) < 1024) {
            $bytes = 1024;
        }
        $size = @imageInfo(IMAGE_DIR . $file);
        // if Image size and type are available ...
        if ($size) {
            // ... assume actual Image size
            $width = $size[0];
            $height = $size[1];
            // if Image should be scaled ...
            if ($width > PANE_WIDTH || $height > PANE_HEIGHT) {
                // ... calculate scaling factor
                $dx = PANE_WIDTH / $width;
                $dy = PANE_HEIGHT / $height;
                $ratio = min($dx, $dy);
                // keep aspect ratio
                $width = (int) ($width * $ratio);
                $height = (int) ($height * $ratio);
            }
            // emit the HTML
            echo "<table align=\"center\" border=\"0\" cellspacing=\"" . VIEWER_SPACING . "\" cellpadding=\"" . VIEWER_PADDING . "\" width=\"100%\" height=\"100%\">\n";
            echo "  <tr>\n";
            echo "    <td class=\"label\" align=\"center\" valign=\"middle\" width=\"100%\">\n";
            echo "      <b>" . basename($file) . "</b><br>\n";
            echo "      " . number_format(($bytes + 511) / 1024) . " KB&nbsp;&nbsp;<i>({$size['0']} &#215; {$size['1']})</i>\n";
            echo "    </td>\n";
            echo "  </tr>\n";
            echo "  <tr>\n";
            echo "    <td align=\"center\" valign=\"middle\" width=\"100%\" height=\"100%\">\n";
            echo "      <img src=\"" . imageURL($file) . "\" alt=\"" . imageURL($file) . "\" width=\"{$width}\" height=\"{$height}\">\n";
            echo "    </td>\n";
            echo "  </tr>\n";
            echo "</table>\n";
            // get out now!
            return;
        }
    }
    // emit the HTML
    echo "<table align=\"center\" border=\"0\" cellspacing=\"" . VIEWER_SPACING . "\" cellpadding=\"" . VIEWER_PADDING . "\" width=\"100%\" height=\"100%\">\n";
    echo "  <tr>\n";
    echo "    <td class=\"none\" align=\"center\" valign=\"middle\" width=\"100%\" height=\"100%\">\n";
    echo "      " . TEXT_SELECT . "\n";
    echo "    </td>\n";
    echo "  </tr>\n";
    echo "</table>\n";
}
Beispiel #2
0
function fileTag($value, $key, $depth)
{
    // initialize context
    $file = basePath($value);
    $size = @imageInfo(IMAGE_DIR . $file);
    // if Image size and type are available ...
    if ($size) {
        // ... emit the HTML
        echo "<tr><td align=\"left\" valign=\"bottom\" width=\"100%\">\n";
        // indent as required
        indentTag($depth);
        // emit the HTML
        echo "<img align=\"bottom\" src=\"";
        switch ($size[2]) {
            case IMAGE_GIF:
                echo scriptURL("gif.gif");
                break;
            case IMAGE_JPG:
                echo scriptURL("jpg.gif");
                break;
            case IMAGE_PNG:
                echo scriptURL("png.gif");
                break;
            case IMAGE_BMP:
                echo scriptURL("bmp.gif");
                break;
            case IMAGE_WMF:
                echo scriptURL("wmf.gif");
                break;
        }
        echo "\" alt=\"" . $value . "\">";
        echo "<a href=\"" . scriptURL("viewer.php?DPI=" . AGENT_DPI . "&file=" . urlencode($file)) . "\" target=\"" . VIEWER_NAME . "\">";
        echo $value;
        echo "</a>\n";
        echo "</td><td class=\"delete\" align=\"right\" valign=\"bottom\">\n";
        if (SUPPORT_DELETE) {
            echo "<a href=\"javascript:deletePath('" . $file . "')\">" . TEXT_DELETE . "</a>";
        }
        echo "</td></tr>\n";
    }
}