Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Amazon S3 Module provides two functions and one actions.

 

getValue function

getValue takes one parameter. This parameter type is a string that is encoded as a Data URI.

getValue returns the base64 encoded value of the data URI. In other words, it strips out the "data:<mimetype>;base64," and returns the actual data.

 

rule getValue is active {
   select when pageview ".*" setting ()
   pre {
      image = <<data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==>>;
      base64EncodedData = AWSS3:getValue(image);
// Evaluates to iVBORw0KGgoAAAA...
   }
   noop();
}

getType function

getType takes one parameter. This parameter type is a string encoded as a Data URI.

getType performs the exact opposite operation of getValue. Instead of returning the base64 encoded data, getType returns the mimetype of the data URI encoded data.

 

rule getValue is active {
   select when pageview ".*" setting ()
   pre {
      image = <<data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==>>;
      base64EncodedData = AWSS3:getType(image);
// Evaluates to image/png
   }
   noop();
}

upload action

The upload action