Support » Plugin: WP MediaTagger » Thumbnails broken in Admin / Explorer

  • Hello (Bonjour !…),

    thank you for your plugin which is very interesting, but I have some problems in the Explorateur in Admin:
    – the thumbnails are “broken” (can’t be displayed); when I right-click on them and choose “Display image”, I get this message
    “Warning: exif_imagetype(): Filename cannot be empty in /homez.614/freephot/www/Gerard/wp-content/plugins/wp-mediatagger/thumbnail.php on line 5
    Exif problem : exif_imagetype(”) returned ‘FALSE’
    [GD Version] => bundled (2.0.34 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [T1Lib Support] => 1
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 1
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] =>

Viewing 11 replies - 1 through 11 (of 11 total)
  • I have found the reason why thumbnails were not displayed in WP Admin.
    My hosting company (OVH) doesn’t provide Image Magic Library for shared hosting, and the test on line 1811 in mediatagger.php was not working.
    I have put commentaries slashes from line 1811 to 1815, and the thumbnails are displayed now.

    This looks like a great plugin, but I am experiencing the same problem.
    I tried commenting out these lines, but they didn’t seem to be related and I wondered if I was looking at the wrong place

    Could you let me know exactly which lines of code you’ve commented out please?
    Thank you very much


    In the mediatagger.php file, look for this function:
    private function get_optimized_thumbnail($media_info, $img_h)

    and comment these lines:

    if (self::$opt[‘result_display_optimize_xfer’] == 1)
    $img_html = ‘src=”‘ . self::$PLUGIN_DIR_URL . ‘thumbnail.php?s=’ . $media_info->image . ‘&w=’ . $img_w . ‘&h=’ . $img_h . ‘” ‘;

    Thank you, I commented out those lines (906-908 in version 4.0.4). However the same problem remains that the images are broken and when I display the image I get the same error as above.

    I’m guessing there must be an update to this plugin that has added more code and changed the position of these specific lines of code.

    I’ve found some other error messages that I’ve also added on here, my guess is that this probably now relies more on Magic Library than it did before which might explain when the problem persists as well as explain the other errors.

    Thank you raivavae!
    And urbanhaze – you’re right, it’s lines 905-908. It worked for me like this:

    LINE 905 /* Make thumbs work in admin
    		if (self::$opt['result_display_optimize_xfer'] == 1)
    			$img_html = 'src="' . self::$PLUGIN_DIR_URL . 'thumbnail.php?s=' . $media_info->image . '&w=' . $img_w . '&h=' . $img_h . '" ';
    		End comment*/

    @webbrewers thank you, you’re right
    – that makes the thumbnails work in the admin.

    I was having a similar problem on the public side, but I’ve since figured out that by changing the option in the “Output Format” on the setting “Optimize thumbnail transfer” to “No”
    This then stops the same error from occurring on the public side of the site.

    As an aside, if you have SSH access to your host, you may be able to install the GD Library, the lack of which seems to be what causes these problems, so that may be a workaround to this problem.

    Funny, I just posted another question about missing thumbs on the site and figured out it was the setting in the options too.
    This site is on a host I’ve not used before (no SSH access as far as I know) so it could be what you say. I’ll probably ask them if it’s possible.

    my hosting service ( seems to have the GD Library running, yet the plugin shows broken thumbnails, unless I disble the “Optimize thumbnail transfer” setting.
    This is what my hosting reports about the installed GD Library:

    GD Support enabled
    GD Version bundled (2.0.34 compatible)
    FreeType Support enabled
    FreeType Version 2.2.1
    T1Lib Support enabled
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XPM Support enabled
    XBM Support enabled
    JIS-mapped Japanese Font Support enabled

    Is there anything else I may do to sort out the problem?
    Thanks! 🙂

    For what it’s worth, I don’t think GD is the problem (entirely).

    The thumbnail.php uses undefined variables. One of them, $s, is used in the exif_imagetype() function call. This is why you see the error “Warning: exif_imagetype(): Filename cannot be empty in…” – the code is actually outputting the value of $s in this error message but since $s is not defined we’re not seeing it.

    You can add

    $s = $_GET[‘s’];
    $w = $_GET[‘w’];
    $h = $_GET[‘h’];

    to the top of your file and that should fix your thumbnail issues. That said, that’s very loose and assuming those params are always going to be used when accessing thumbnail.php.

    Hopefully it will get you on the right track.

    Ok so this is my updated thumbnail.php file, feel free to use:

    	$s = '';
    	$w = 0;
    	$h = 0;
    	if (isset($_GET['s'])) {
    		$s = filter_var(trim($_GET['s']), FILTER_VALIDATE_URL);
    		if ( ! $s ) { // haven't got a valid URL file so give up now..
    			echo 'FATAL EXCEPTION: Not a valid file';
    	if (isset($_GET['w'])) {
    		$w = filter_var(trim($_GET['w']), FILTER_VALIDATE_INT);
    	if (isset($_GET['h'])) {
    		$h = filter_var(trim($_GET['h']), FILTER_VALIDATE_INT);
    	// if we don't have BOTH dimensions
    	// default to actual image (direct, no need to start creating images, huh?)
    	// otherwise we could end up with mis-shaped image
    	if ( ! ( $w && $w > 0 )
    			|| ! ($h && $h > 0 ) ) {
    		header('Location: ' . $s);
    	$image_type = exif_imagetype($s);
    	switch($image_type) {
    		case IMAGETYPE_JPEG: $src = imagecreatefromjpeg($s); break;
    		case IMAGETYPE_GIF: $src = imagecreatefromgif($s); break;
    		case IMAGETYPE_PNG: $src = imagecreatefrompng($s); break;
    			echo "Exif problem : exif_imagetype('$s') returned '" . (!$image_type ? 'FALSE' : $image_type) . "' <br/>";
    			echo "<pre>";print_r(gd_info());echo "</pre>";
    			echo "Aborting<br/>";
    	header("Content-type: {$image_type}");
    	list($width, $height) = getimagesize($s);
    	$thumb = imagecreatetruecolor($w, $h);
    	imagecopyresampled($thumb, $src, 0, 0, 0, 0, $w, $h, $width, $height);
    Plugin Author phd38


    Thanks all for your contribution.

    Am very sorry to have let it uncovered – I will include it as part of the next release.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Thumbnails broken in Admin / Explorer’ is closed to new replies.