WordPress.org

Support

Support » Plugins and Hacks » Hacks » WP-FileManager Tweak for Viewing Images

WP-FileManager Tweak for Viewing Images

  • I utilize WP-FileManager to upload an occasional small batch of image files (JPEG) onto my site, rather than running an FTP client.

    It’s a great plugin, except that the view image feature malfunctioned whenever I attempted to view any graphics file. It would show a broken image icon instead.

    I like this plugin so much that I decided to tweak it so it works like it’s supposed to…

    ** Go to “Editor” under “Plugins” menu and “WP-FileManager” from the drop-down list to edit it.
    ** Locate “wp-filemanager/incl/view.inc.php” from the list on the right-hand side of the browser and click on it, which will reveal its PHP syntax.
    ** Search/Find the following syntax…

    <img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/incl/libfile.php?path=".htmlentities(rawurlencode($path))."&filename=".htmlentities(rawurlencode($filename))."&action=view' width='$width' height='$height' alt='$StrImage'>";

    ** Disable using the appropriate PHP syntax or simply delete it.

    ** Add the following syntax in its place…

    $part_1 = 'http://'.$_SERVER['HTTP_HOST'].'/';
    $part_2 = $_GET['path'];
    $part_3 =  htmlentities(rawurlencode($filename));
    echo '<img src="'.$part_1.$part_2.$part_3.'" alt="'.$part_3.'" />';

    Click the “Update File” button and try viewing any image uploaded to your server.

    Quick note: The zoom in/out function doesn’t work! I haven’t found a fix for that yet.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WP-FileManager Tweak for Viewing Images’ is closed to new replies.