Make WordPress Core


Ignore:
Timestamp:
10/26/2016 07:27:51 AM (8 years ago)
Author:
mikeschroder
Message:

Media: Add support for rendering PDF thumbnails.

When support for PDFs is available, on upload,
render 'Thumbnail', 'Medium', 'Large', and 'Full' sizes of
the first page, and save them in attachment meta.

Use these renders within Add Media, Media Gallery and List views,
Attachment Details, Post/Attachment Edit screens, and Attachment pages.

Support available by default via Imagick -> ImageMagick -> Ghostscript,
but can be provided by any WP_Image_Editor that supports PDFs.

Props adamsilverstein, azaozz, celloexpressions, desrosj, dglingren, ericlewis, ipstenu, joemcgill, joyously, markoheijnen, melchoyce, mikeschroder, tomauger.
Fixes #31050.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media-template.php

    r38468 r38949  
    291291                <# if ( data.uploading ) { #>
    292292                    <div class="media-progress-bar"><div></div></div>
    293                 <# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #>
     293                <# } else if ( data.sizes && data.sizes.large ) { #>
    294294                    <img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" alt="" />
    295                 <# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #>
     295                <# } else if ( data.sizes && data.sizes.full ) { #>
    296296                    <img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" alt="" />
    297297                <# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
     
    455455                        <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
    456456                            <img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
     457                        <# } else if ( data.sizes && data.sizes.medium ) { #>
     458                            <img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
    457459                        <# } else { #>
    458460                            <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
Note: See TracChangeset for help on using the changeset viewer.