Author Topic: Thumbtype when Thumbpath is used...  (Read 476 times)

CainVampyr

  • Jr. Member
  • **
  • Posts: 31
Thumbtype when Thumbpath is used...
« on: June 07, 2010, 03:41:37 pm »
Hi,

If it's not too much of a bother I wish to request a 'thumbtype' book property for when Thumbpath is used, this is to override the hardcoded ".jpg" extension wish seems unnecessarily restrictive...

PS: We'r hacking it by registering the property in 'MegaZine.as' at the 'registerSettings' function and then we access the property from 'PageSide.as' at the 'loadThumbnail' function:

MegaZine.as:
(...)
private function registerSettings():void {
  (...)
  settings_.register("thumbauto", false);
  settings_.register("thumbscale", 0.25);
  settings_.register("thumbpath", "");
  settings_.register("thumbtype", ".jpg");
  (...)
}
(...)

PageSide.as:
(...)
    private function loadThumbnail():void {
        var l:LoaderExt = new LoaderExt();
        lec_.add(l.contentLoaderInfo, Event.COMPLETE,
                handleThumbnailDone, LECUtil.AUTO_REMOVE);
        lec_.add(l.contentLoaderInfo, IOErrorEvent.IO_ERROR,
                handleThumbnailError, LECUtil.AUTO_REMOVE);
        lec_.add(l.contentLoaderInfo, SecurityErrorEvent.SECURITY_ERROR,
                handleThumbnailError, LECUtil.AUTO_REMOVE);
        var mz:IMegaZine = page_.chapter.megazine;
       
        l.loadPrioritized(new URLRequest(mz.getAbsPath(mz.settings.
                getSetting("thumbpath") + number_ + mz.settings.
                getSetting("thumbtype")
)), null, 10);
    }
(...)

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Thumbtype when Thumbpath is used...
« Reply #1 on: June 12, 2010, 05:06:19 pm »
Good idea, have a look at revision 440. I decided against an additional attribute, though, but instead adjusted the thumbpath one to optionally support a 'variable', {{num}} which will be replaced with the page number of the page for which a thumbnail will be loaded.
Basically, if it was thumbs/ it can (optionally, old way still works) be written as thumbs/{{num}}.jpg. Which thus allows different extensions, e.g. thumbs/{{num}}.png.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

CainVampyr

  • Jr. Member
  • **
  • Posts: 31
Re: Thumbtype when Thumbpath is used...
« Reply #2 on: June 14, 2010, 11:51:13 am »
Awesome!

I'll take a look as soon as I have a minute to spare :D