stopping an image actually being published to the resources folder

Hi everyone
Just a quick question…. I have an action that is applied to a normal image which swaps the image src url for a base 64 version, but ideally I wouldn’t want the image to actually be added to the resources folder because its not needed. So my question is has anyone come across any way actually do that? It sounds simple but I haven’t actually come across any control for disabling the copying of the image.

all the best max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No, and I spent quite a long time on this when working on the original Scripty Actions. Once a fwFile has been generated as a resource by calling toString() on its representation, you can’t get rid of it. Even if you fwDelete() the representation, the file exists and will be published/uploaded.

Walter

On Jan 21, 2014, at 9:47 AM, max wrote:

Hi everyone
Just a quick question…. I have an action that is applied to a normal image which swaps the image src url for a base 64 version, but ideally I wouldn’t want the image to actually be added to the resources folder because its not needed. So my question is has anyone come across any way actually do that? It sounds simple but I haven’t actually come across any control for disabling the copying of the image.

all the best max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is there an acceptably “ugly” alternative method – like inserting an image
placeholder, sizing it but leaving it blank (Freeway Pro generates a
“blank.gif” for it, I think) then attach a new src attribute via extended?
FWP generates only the one blank.gif and outputs the html the way you want
it.

Not pretty, but maybe an idea there?


Ernie Simpson

On Tue, Jan 21, 2014 at 9:51 AM, Walter Lee Davis email@hiddenwrote:

No, and I spent quite a long time on this when working on the original
Scripty Actions. Once a fwFile has been generated as a resource by calling
toString() on its representation, you can’t get rid of it. Even if you
fwDelete() the representation, the file exists and will be
published/uploaded.

Walter

On Jan 21, 2014, at 9:47 AM, max wrote:

Hi everyone
Just a quick question…. I have an action that is applied to a normal
image which swaps the image src url for a base 64 version, but ideally I
wouldn’t want the image to actually be added to the resources folder
because its not needed. So my question is has anyone come across any way
actually do that? It sounds simple but I haven’t actually come across any
control for disabling the copying of the image.

all the best max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Max,
How are you encoding the image? I suspect you are using the final image src in which case the image has already been created and is almost certainly already in the Resources folder. If you can live with only encoding passthrough images then you can get the path to the original file and use that instead. If you run the conversion at fwAtContent then you should have full control over what the item outputs.

If you need to use a non-passthrough image then Freeway will have to create the image before you can encode it. You could look for the image after the Action has encoded it and destroy it manually (I’ve done this before once or twice using a rm command in the terminal) but there is no certainty that the image isn’t used elsewhere in the site. At this point leaving a redundant image in the Resources folder appears to be less of an issue than trying to remove it.
Regards,
Tim.

On 21 Jan 2014, at 14:47, max wrote:

Just a quick question…. I have an action that is applied to a normal image which swaps the image src url for a base 64 version, but ideally I wouldn’t want the image to actually be added to the resources folder because its not needed.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This was my conclusion, which is why the FX Actions and first-generation Scripty Actions all litter your Resources folder with prototype-packed.js and prototype.js, even though those files are actually being sourced from Google’s CDN.

Walter

On Jan 21, 2014, at 11:13 AM, Tim Plumb wrote:

At this point leaving a redundant image in the Resources folder appears to be less of an issue than trying to remove it.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Tim Walter and Ernie
thanks for the answers and suggestions.
Tim no I am not actually encoding the image within freeway I just use it as a place holder and swop the src… I have a little free mac application which I just drop the image onto and it generates the code for me and I just copy the code from there.
The action is something really simple and crude (I haven’t even bothered to add a fwbigprompt) and was created just for me to speed up a job, where I needed to have a self contained html file (no outside resources). I was sick and tired of copying the code from my little application, then clicking on the extend, then choosing img tab then writing src then pasting the code. So I quickly wacked this together which works… but it would have been nice to not have the image uploaded as well.
From the reply’s above there seems no instant fwDelete() for files…. but thanks again for confirming. If anyone is interested or could do with this I have included the action below

All the best max

  <item-action name="IMG-64 Source">
  <action-version version="1">
  Max Fancourt :o) - aka dada 
  </action-version>
  
  <action-text name="code" title="64 bit code">
  <action-javascript>
  function fwAfterEndBody(){
  var imageTag = fwDocument.fwTags.fwFind(fwItem,"img");
  if (imageTag){
  imageTag.src=fwParameters['code'];}
  }
  </action-javascript>
  </item-action>

actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You could take this a little further. The Actions API includes a way to get the raw binary data from a file. It’s very simple to base64 a string in JS – I have a library around here somewhere I found in a few minutes’ googling – and then all you would have to do is prepend the mime-type of the image to the beginning. That’s all a data-URL is. You could make an Action that did the following: get a fwFile reference to the published image, convert its data to base64, change the src of the original image to a data-URL, and you’re done. It still won’t keep that file from being output, but that appears to be a limitation of the application and the API.

Walter

On Jan 21, 2014, at 12:05 PM, max wrote:

Hi Tim Walter and Ernie
thanks for the answers and suggestions.
Tim no I am not actually encoding the image within freeway I just use it as a place holder and swop the src… I have a little free mac application which I just drop the image onto and it generates the code for me and I just copy the code from there.
The action is something really simple and crude (I haven’t even bothered to add a fwbigprompt) and was created just for me to speed up a job, where I needed to have a self contained html file (no outside resources). I was sick and tired of copying the code from my little application, then clicking on the extend, then choosing img tab then writing src then pasting the code. So I quickly wacked this together which works… but it would have been nice to not have the image uploaded as well.
From the reply’s above there seems no instant fwDelete() for files…. but thanks again for confirming. If anyone is interested or could do with this I have included the action below

All the best max

 <item-action name="IMG-64 Source">
 <action-version version="1">
 Max Fancourt :o) - aka dada 
 </action-version>

 <action-text name="code" title="64 bit code">
 <action-javascript>
 function fwAfterEndBody(){
 var imageTag = fwDocument.fwTags.fwFind(fwItem,"img");
 if (imageTag){
 imageTag.src=fwParameters['code'];}
 }
 </action-javascript>
 </item-action>

actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options