Jump to content


Photo

"Put images in SubFolder" in API


  • Please log in to reply
4 replies to this topic

#1 fuuuuu

fuuuuu

    FireworksFreak

  • Members
  • PipPip
  • 19 posts

Posted 05 March 2010 - 01:15 PM

tl;dr: I need API access to the "Put Images in SubFolder" checkbox in the Export dialogue box. I've tried ExporSettings object, and fw.exporHTMLAndImages() function and neither have it.

Hi,

A little background:
I've been coding a custom HTML template and one of the last things that I need to do is to create a custom interface for it.

I need a way to export HTML and Images without using the Fireworks Export dialogue box (File > Export or Ctrl + Shift + R). In other words I want to create a JSF file that will export HTML and images (and later I will create a SWF that will control the different options), and I've found a way to do this but I can't seem to find a way to put images in a subfolder. Currently this is the code that I have that controls the export:

var html_folder = fw.browseForFolderURL("Choose Folder");
var html_name = "test.html";
var img_folder = "/images/";

var html_settings = new ExportSettings();// this controls all the export settings except for the "put images in subfolder" checkbox!!
html_settings.exportFilesStyle = "HTML and Images";
html_settings.fileExtension = "html";
html_settings.htmlDestination = "same";
html_settings.sliceAlongGuides = false;
html_settings.sliceUsingUrls = true;
html_settings.templateName = "MyTemplate";

fw.exportHtmlAndImages(null,  html_file, html_folder + img_folder);

According to the Docs, fw.exportHtmlAndImages() uses the third argument to either export an image and name it if it's a single image, or export the images into a folder of that name if there are multiple images, but this does not work! Any help is appreciated. Thanks.

#2 jdunning

jdunning

    Fireworks Ninja

  • Members
  • PipPipPipPipPip
  • 173 posts

Posted 18 March 2010 - 07:02 PM

Can you move the images to the folder using the Files API after the export finishes?

For creating your custom export dialog, you might find this library useful: http://bit.ly/lKwQu

It lets you create a Flex dialog using JavaScript, rather than MXML, and you can interact directly with the Fireworks API, rather than using awkward MMExecute() calls.

#3 fuuuuu

fuuuuu

    FireworksFreak

  • Members
  • PipPip
  • 19 posts

Posted 21 March 2010 - 07:53 PM

Can you move the images to the folder using the Files API after the export finishes?

For creating your custom export dialog, you might find this library useful: http://bit.ly/lKwQu

It lets you create a Flex dialog using JavaScript, rather than MXML, and you can interact directly with the Fireworks API, rather than using awkward MMExecute() calls.


Yes, that's exactly what I used. It is extremely useful to code in JSON and do a ctrl+F5 on the panel to refresh it immidiately. Thank you for doing this.

I also think I found a solution. The function to export HTML is fw.exportHTMLAndImages(document, html folder, imaage folder). The FW documentation mentioned that for the images folder you had to specify a folder for example: C:\website\images\ but that wasn't working at all (it would export images to parent folder, C:\website\). I thought of using an image as oppose to a folder for example: C:\website\images\spacer.gif but that gave me an error.

For some reason the answer is to point to a non-existant directory within the directory that you want your images in, for example : C:\website\images\image (no extension). And this works! I have no idea why it works, since there is no file or directory "image" within the images folder(which exists).

Thanks again for that great pluggin and for your response.

#4 jdunning

jdunning

    Fireworks Ninja

  • Members
  • PipPipPipPipPip
  • 173 posts

Posted 22 March 2010 - 08:15 PM

Yes, that's exactly what I used. It is extremely useful to code in JSON and do a ctrl+F5 on the panel to refresh it immidiately. Thank you for doing this.

Glad you're finding it useful. Let me know if you have any questions or feature requests.

For some reason the answer is to point to a non-existant directory within the directory that you want your images in, for example : C:\website\images\image (no extension). And this works! I have no idea why it works, since there is no file or directory "image" within the images folder(which exists).

Crazy, but hardly the only bug in the API.

#5 Lilly

Lilly

    Fireworks Sparkle

  • Members
  • Pip
  • 2 posts

Posted 14 August 2010 - 01:38 AM

:beatdown: Hey Fuuuuu,
This is Lilly Michelle and am newbie to this forum. Your info is very informative to everyone. Putting images in sub folder in API it's a great idea. Your info is very useful to me in the future. I'm very very thankful to you. I'm feeling great to be a part of this forum. Because today I learnt about a new thing before which I don't know...
:pixelsen:
______________________________________________________________________________________________________________

Want to get-on Google's first page and loads of traffic to your website? Hire a SEO Specialist from Ocean Groups seo pecialist