Page 1 of 2 12 LastLast
Results 1 to 10 of 106

Thread: HOWTO: Thumbnails for OpenOffice.org 2 files

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Location
    Prague, Czech Republic
    Beans
    68

    HOWTO: Thumbnails for OpenOffice.org 2 files

    This also works for OOo1 files created or altered with OOo2. Beacuse OOo2 saves thumbnail of document into created file all what is needed is to extract the image a save it with right name
    So first create file named ooo2-thumbnailer in /usr/bin
    Code:
    sudo gedit /usr/bin/ooo2-thumbnailer
    and put in it following code
    Code:
    #!/usr/bin/python
    # released into the public domain http://creativecommons.org/licenses/publicdomain
    import zipfile
    import sys
    import gnomevfs
    
    inURL=gnomevfs.get_local_path_from_uri(sys.argv[1])
    outURL=sys.argv[2]
    
    zip=zipfile.ZipFile(inURL,mode="r")
    picture=zip.read("Thumbnails/thumbnail.png")
    thumbnail=open(outURL,"w")
    thumbnail.write(picture)
    thumbnail.write("/n")
    zip.close()
    thumbnail.close()
    and save the file.
    Now we need to make it executable
    Code:
    sudo chmod +x /usr/bin/ooo2-thumbnailer
    The next step is to tell Gnome how to use this thumbnailer. So create file ooo2.schemas in /usr/share/gconf/schemas
    Code:
    sudo gedit /usr/share/gconf/schemas/ooo2.schemas
    and paste in it following code
    Code:
    <gconfschemafile>
        <schemalist>
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
         
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
    <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
         
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
        </schemalist>
    </gconfschemafile>
    and save it.
    Now there are two ways to start gnome to use this thumbnailer
    1) reboot
    2) tell gnome to read this file:
    Code:
    gconftool-2 --install-schema-file /usr/share/gconf/schemas/ooo2.schemas
    and restart nautilus
    Code:
    killall -9 nautilus
    Last edited by minio; March 19th, 2009 at 09:15 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    Portland, Oregon
    Beans
    433
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Awesome howto, works perfectly! Anyone know if there's a quick/easy way to add a small icon or watermark over the thumbnail?

  3. #3
    Join Date
    Aug 2005
    Beans
    123

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Could someone provide a screenshot to show the finished product?

  4. #4
    Join Date
    Feb 2005
    Location
    Chile
    Beans
    103

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Quote Originally Posted by OttoDestruct
    Could someone provide a screenshot to show the finished product?
    Here's a shot of my homework, two Writer files: one with images, and the other one with formulas.

    If you decide to try out the thumbnails and don't like the results afterwards, you can roll back by deleting the two files:
    Code:
    sudo rm /usr/bin/ooo2-thumbnailer
    sudo rm /usr/share/gconf/schemas/ooo2.schemas
    And then restart Gnome (or nautilus, following minio's instructions).

    Btw, thank you minio for the how-to . The only downside I notice is that Ooo2 generates thumbnails with transparent backgrounds, so they don't look that good if you have set a background in nautilus.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screenshot-Lab 3.png 
Views:	1669 
Size:	154.2 KB 
ID:	2934  
    Last edited by NeTo; October 16th, 2005 at 06:59 AM.

  5. #5
    Join Date
    Apr 2005
    Location
    France
    Beans
    9
    Distro
    The Feisty Fawn Testing

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Excellent
    Thanks.

  6. #6
    Join Date
    Jul 2005
    Location
    Grimstad, Norway
    Beans
    80
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    I have followed the instructions perfectly, and I still can't get this to work. Every file is in the right place with the right owner and permissions. Does anyone have a hint?

  7. #7
    Join Date
    Sep 2005
    Location
    Mexico
    Beans
    38
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    yay is working

  8. #8
    Join Date
    Mar 2005
    Location
    Pennsylvania
    Beans
    384
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Can anyone give me a pointer on how to create a schema for something other than an oasis-document file?

    I want to create thumbnails in nautilus for .cbr / .cbz files based on the first image in the files. (.cbr files are just in RAR format, while .cbz files are in ZIP format) The archives will just be a collection of .jpg image files.

  9. #9
    Join Date
    Mar 2005
    Location
    Pennsylvania
    Beans
    384
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Thanks a lot, guys. Also, thanks go out to the folks at comp.lang.python, who helped me write the python code that follows.

    Here is the code to create thumbnails for .cbz sequential image archives (usually associated with comical or comix in linux or cdisplay on MSWindows).

    Code:
    sudo gedit /usr/bin/comical-thumbnailer
    Code:
    #!/usr/bin/python
    
    import zipfile
    import sys
    import gnomevfs
    import Image
    import StringIO
    
    inURL=gnomevfs.get_local_path_from_uri(sys.argv[1])
    outURL=sys.argv[2]
    
    zip=zipfile.ZipFile(inURL,mode="r")
    jpeglist=[x for x in zip.namelist() if '.jp' in x]
    try:
      picture=zip.read(jpeglist[0])
    except IndexError:
      print 'No jpeg found'
    
    zip.close() #close the file, since we no longer have need of it
    image = Image.open(StringIO.StringIO(picture)) # create image object from file-like object
    image.thumbnail((128,128),Image.ANTIALIAS) #create the thumbnail
    image.save (outURL, "PNG") #output the file in the proper format
    Code:
    sudo chmod a+rx /usr/bin/comical-thumbnailer
    Code:
    sudo gedit /usr/share/gconf/schemas/comical.schemas
    Code:
    <gconfschemafile>
        <schemalist>
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@x-cbz/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@x-cbz/enable</applyto>
                <owner>comical-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@x-cbz/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@x-cbz/command</applyto>
                <owner>comical-thumb</owner>
                <type>string</type>
                <default>/usr/bin/comical-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
        </schemalist>
    </gconfschemafile>
    Code:
    gconftool-2 --install-schema-file /usr/share/gconf/schemas/comical.schemas

  10. #10
    Join Date
    Dec 2005
    Beans
    9

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Quote Originally Posted by mmcmonster
    Thanks a lot, guys. Also, thanks go out to the folks at comp.lang.python, who helped me write the python code that follows.

    Here is the code to create thumbnails for .cbz sequential image archives (usually associated with comical or comix in linux or cdisplay on MSWindows).
    I suspected it was to be used for comic book archives when I saw it on comp.lang.python.

    Comix also includes a comic book thumbnailer (in later versions) called comicthumb, written by Christoph Wolk who is a regular on these forums I believe. It is in essence very much like the one you have written, but it supports RAR and tar archives as well and has some other nice features. You can check it out if you want.

    Lazy link: http://comix.sourceforge.net/

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •