Show thumbnail of an OPC file

Home Forums Open Packaging Conventions Show thumbnail of an OPC file

Tagged: 

This topic contains 6 replies, has 2 voices, and was last updated by  Eric White 8 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #3279

    Chiz
    Participant

    Hi,

    I have an OPC-file. It works fine. Now I’m trying to add thumbnail, so when this file is shown in Windows Explorer or, for example, as attachment in browser, my thumbnail is displayed.

    I tried to add
    <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail" Target="/thumbnail.png" Id="RTN1" />
    to .rels file. I tried jpeg too. I tried 32×32 and 64×64 sizes.

    [Content_Types].xml:
    <Default Extension="png" ContentType="image/png" />
    or <Default Extension="jpeg" ContentType="image/jpeg" />

    Structure of my file:
    – _rels
    – – .rels
    – thumbnail.png
    – other files
    – [Content_Types].xml

    • This topic was modified 8 years, 7 months ago by  Chiz. Reason: formatting
    • This topic was modified 8 years, 7 months ago by  Chiz.
    #3284

    Eric White
    Keymaster

    I’m afraid this is something that I have no experience with.

    Here is how I would solve this – get a DOCX that has no custom thumbnail, then copy it, add a custom thumbnail to the copy, then use the Open XML SDK Productivity Tool to compare the two. You should be able to identify each and every precise modification that you need in order to create a custom thumbnail.

    I found an interesting thread here:

    http://answers.microsoft.com/en-us/office/forum/office_2010-word/docx-files-do-not-have-thumbnails-but-some-docx/c00a3f68-34bd-4a9d-af69-0bb8bb5380bb?auth=1

    #3288

    Chiz
    Participant

    Thank you, Eric, for your answer. I will try your idea with DOCX and Productivity Tool.

    #3289

    Chiz
    Participant

    I made it work only if I put xps as file extension. If I put my own ext – it shows associated app’s icon. If I put ext, which is not associated with an app – white file icon.

    #3293

    Eric White
    Keymaster

    At this point, I have no further information. I have never read the standard on putting icons on a document – don’t recall that this is in the standard, although it very may well be. Do you know for certain that this is possible?

    #3318

    Chiz
    Participant

    I’ve made some more research and it appeared that to draw proper image you need to associate your file extension with proper dll (which will draw thumbnail) via registry. This is described well in IThumbnailProvider Re-Visited. Showing Thumbnail has nothing to do with OPC standard.

    #3338

    Eric White
    Keymaster

    Good to know, thanks.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.