Use S3Reader2 plugin as API - imageresizer

Can you provide an example of using the S3Reader2 plugin with ImageResizer.ImageBuilder.Current.Build?
I would like to output an S3 image through Response.Output / Response.Write
Thnx in advance

If you're sending the output to Response, then you should use the URL API instead; writing your own handler will introduce a lot of issues.
That said, it's easy to use the S3 plugin from .Build. Just provide a virtual path like so:
ImageBuilder.Current.Build("~/s3/mybucket/myfile.jpg", outstream, instructions);

Related

Uploading files via SAP Gateway via SAPUI5 (function import vs create_stream method)

I was wondering what the best practice is regarding the uploading of files via the gateway.
There is a possibility to pass parameters via a function import. One could pass the name and binary content to a function import in the gateway and upload it that way.
Another possibility is to upload it via the CREATE_STREAM method found in the DPC_EXT class.
What is the cleanest way to do this? They both seem to be working just fine.
Create stream. It's the more HTTP, REST, and OData-compliant way.
Function imports are not compliant to these standards, and should be avoided.
Function import is a way to do operations that does not match CRUDQ operations. For example accepting a document or confirming sale, You could of course use a Create method or an update but if You alreday using them for something HTTP PUT and GET can be used for function import.
It however should NOT be used if the operation matches Create Read Update Delete or Query.
EDIT:
Create (Read) Stream is a great (and recommended) way of sending files and it also uses GET and PUT so use this if You're just sending files (even with parameters).
Cheers.

Get a file from IVirtualImageProvider

I have a custom plugin for serving images trought LDAP IPlugin
and IVirtualImageProvider now im doing a task of importing users from LDAP to our own system and as such i need to import those images, i was wondering if there is any way of using the plugin i previously created to import those images, perhaps something in the like of
ImageResizer.ImageJob i = new ImageResizer.ImageJob("http://host/ad/A68986", "~/uploads/<guid>.<ext>", new ImageResizer.ResizeSettings(
"width=2000;height=2000;format=jpg;mode=max"));
But the first parameter (source) would be "resolved" by my LDAP plugin, ImageResizer API
Edit: I figured out this is possible since source can be a IVirtualFile, that implies that i know in advance which one to create (for my case my own ldap) it would be nice to pass the url and somehow get the correct IVirtualFile
Yes, ImageJob resolves any 'app-relative virtual paths' using installed IVirtualImageProviders. Such paths must begin with "~/", and match the path prefix and syntax you've designed, of course.
In your case, this might look like
var i = new ImageResizer.ImageJob("~/ad/A68986", "~/uploads/<guid>.<ext>",
new ImageResizer.ResizeSettings("width=2000;height=2000;format=jpg;mode=max"));
You can also call Config.Current.Pipeline.GetFile to get an IVirtualFile reference based on a path, if you just want the original data.

Load *.vtl file from remote location

is it possible in dotCMS to parse a vtl file from a remote source?
// this doesn't seem to work
#dotParse("https://some.random.source.com/vtl/index.vtl")
Not normally and it would be very easy to write a plugin to do it. Without writing any java code, it should be possible to do something like this:
#set($code = $import.read("https://some.random.source.com/vtl/index.vtl"))
$render.eval($context, $code)
The downside is that it will probably be much slower than just rendering a vtl in dotcms.

How to send image through axis2

My Service class designed through Axis2, I am able to send any data type of resords like
(premetive datatypes). I don't know how to send Image file.
Have a read of the documentation - its very good for Axis2 -> http://axis.apache.org/axis2/java/core/docs/mtom-guide.html
There are some code examples in there too on how to transfer images using Axis2
Use soap with attachment option or MTOM..Following posts are helpful
http://www.ibm.com/developerworks/webservices/library/ws-soapatt/
http://www.keith-chapman.org/2008/09/attachments-mtom-swa-and-base64binary.html

Uploadify with NodeJS | Post parameters not being sent

I'm building my latest app using nodeJS and need to be able to upload multiple files. I have chosen to use Uploadify flash based file uploader.
Unfortunately the 'scriptData' vars don't seem to be being sent. Usual method of retrieval of POST vars in node looks like var postDataValue = req.body.postDataKey; but with Uploadify the req.body object is empty.
Hope someone can help with this.
I had to send the parameters via query string in the end. Must be something to do with NodeJS.
It's not Node.js. req.body is not part of node. It's built into BodyParser and provided by Connect. Mainly used in Express.
See http://senchalabs.github.com/connect/middleware-bodyParser.html
If you don't use it, the req.body object should be empty.