Support

Account

Home Forums Feature Requests Show PDF Thumbnails on file uploads if available Reply To: Show PDF Thumbnails on file uploads if available

  • Hello,

    FYI, I had same issue and did this hook to make it:

    function acf_change_icon_on_files ( $icon, $mime, $attachment_id ){ // Display thumbnail instead of document.png
    		
    		if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) === false && $mime === 'application/pdf' ){
    			$get_image = wp_get_attachment_image_src ( $attachment_id, 'thumbnail' );
    			if ( $get_image ) {
    				$icon = $get_image[0];
    			} 
    		}
    		return $icon;
    	}
    	
    	add_filter( 'wp_mime_type_icon', 'acf_change_icon_on_files', 10, 3 );