Using SuiteScript to extract metadata from Images in the file cabinet - netsuite

I'm looking to build a particular solution for a client which needs to dynamically resize images stored in the Netsuite file cabinet.
Is there any way within suitescript/netsuite to grab the width and height of an image in the file cabinet?
Cheers!

SuiteScript is basically javascript so if you can find any third party library that does this, you can add that.

I don't know if you can do this with SuiteScript, but you can do it via Web Services. If you do a "get" on each image file with PHP, you can then use the PHP getimagesize function to get the image dimensions.

Netsuite doesn't have anything native for this but a simple-ish solution would be to create a node app on AWS Lambda that accepts an image and resizes it.
You can't deploy a user event script on images so you'd be stuck with a scheduled script or a map reduce script. You can feed that with a list of images created since some date/time or you could set a User Note when the image has been resized and filter against that.
I've used the node package 'sharp' for this sort of thing and the speed and quality are good.

Related

can't import design in flutter app using api

I want to develop an invitation card maker app in flutter so the issue is that I don't know what kind of data I will need to import from the backend to make my cards editable. i have designed cards in photoshop but I don't know how to make them editable in a mobile app. if anyone has a suggestion please give me your suggestions
I'm glad to be able to help you.
In those cases you do the following:
Receive image to edit.
Use external library made to edit photos (https://pub.dev/packages/image_editor_pro)
Send edited image to the backend and replace the old one.
Hi all I am very happy that I finally found the solution.
So we have to first import the background image from API and load text data on it then we can use flutter packages to edit those texts.
But there is one thing you need to do before you import designs to the mobile app. You will need to have a perfect pixel size of font and background otherwise it will be overlapped.
I have images with dimensions of 3000*5000 so I have used aspect ratio for the responsiveness in every device.
And I have used Figma to design cards so we can get all CSS very fast for every line of text and then I am converting it to JSON using CSS to js converter and js to JSON converters.

how to upload image in mongodb using node js under a specific model

I am working on a project (Something like a shopping website) and I want to upload a product describing its name, price and image. It's pretty simple to add name, price in a database, but not finding a proper way to have all those information along with a product Image as there is no specific way to store image like we store Strings and Numbers etc. I do not want to upload a file locally with a package called multer. I have tried using Grid FS storage, but I do not how to make it keep all three information together as a single package. I am looking for a better way so I could use it when I will make my website live.
You can convert an image to a base64 encoded string. See this question for more information. Also see this npm package.
But be careful! As far as I know MongoDB has a maximum storage size for a document. If you plan to save a couple high-res images in that document you will go better with a file storage.

Azure Custom Vision: Is it possible to store image metadata (NOT tags) in the Custom Vision environment?

I have images with important file metadata (e.g. provenance and processing history) stored locally or in Azure blob storage.
I would like to import (POST) these to the Azure Custom Vision environment (via the API or GUI) (see e.g. https://southcentralus.dev.cognitive.microsoft.com/docs/services/Custom_Vision_Training_3.0) for training while (i) retaining those image metadata and (ii) being able to retrieve them via (a) the Custom Vision API and (b) the Custom Vision GUI.
An example use case would be to purge images of a certain provenance from the Custom Vision store because of a GDPR-related customer request [Aside: I appreciate that Azure Cognitive Services can anyway use the data for improving their models etc.].
As far as I can tell the only way to reference an image POSTed to Custom Vision is via its UUID. Is there any other way to reference metadata stored with that image or:
Would that constitute a feature request?
Could the image metadata be stored inside the image (e.g. JPEG EXIF) (assuming it is possible to retrieve the image itself from the Custom Vision "environment", which it may not be)?
Otherwise, is the only solution to store the returned Custom Vision image UUID in a database elsewhere alongside the required metadata?
NB In the above, by metadata I do not mean tags/labels in the image model-side sense, but rather data-side file metadata.
[Note that Azure Cognitive Services is using stackoverflow for Q&A, so this question is I believe appropriate for stackoverflow.]
Thanks as ever!
I am not part of Microsoft, so it is only my opinion based on my usage of Custom Vision.
I understand your use-case, especially regarding GDPR as you mentioned, but currently adding metadata is not a feature, whether through the API or the GUI.
To answer your questions:
Would that constitute a feature request?
Definitely. You can create an item on UserVoice for this feature (but 1st check if there is not another related existing item): https://cognitive.uservoice.com/forums/598141-custom-vision-service
Could the image metadata be stored inside the image (e.g. JPEG EXIF)
(assuming it is possible to retrieve the image itself from the Custom
Vision "environment", which it may not be)?
You can get the images your previously posted using GetImagesByIds method from the API for example (or GetTaggedImages / GetUntaggedImages). Remember that the images you post are treated: thumbnail images, resized images are generated based on what you posted. These methods provides the links to the images.
I made a quick try by:
- Uploading an image to CustomVision and adding a tag
- Getting its id
- Getting the image through the API
Good news: on the image downloaded with the "originalImageUri" link, I still have some EXIF available (just needed to rename the file as ".jpg" after download):
Otherwise, is the only solution to store the returned Custom Vision
image UUID in a database elsewhere alongside the required metadata?
Right now it is clearly the best solution in my opinion

How can I allow users to change their Liferay portrait from a velocity template?

I´m coding a template for a customize theme and would like to let users change their Liferay portrait from there. In addition, it would be nice to add the functionality provided in the "official" window that gives the possibility to select a part of the uploaded image.
The simplest way I can imagine to do this is "building" a link that directly brings the user to that window without having to pass through his profile. Right now, I´m trying to do this with the JS function "Liferay.Portlet.openWindow" but still I haven't been able to find the correct arguments (including the large URL) to accomplish it.
Is what I´m trying to do possible? if so, could you help me?
I think that the best solution to that would be to build a custom liferay MVC or Vaadin protlet to do just that.
This is because the friendlyURL (large URL as you called it) to take a user to that place is usually generated on the fly within the portal instance so you may not have the correct redirection.
Also you would have to use the method ImageLocalServiceUtil which is used to upload images to do the actually portrait change.

Node.js - PDF, DOC, DOCX to PNG

Is there any library that can parse and generate a PNG from a Doc, Docx and PDF file?
We're implementing a training system using Node, Sails.js, Express and SQL and would like to generate some PNG image tiles for training modules based on a file upload.
I've done some searching and found some libraries in C# that can do all 3, as well as a just PDF impementation for Node but can't find anything that does more than that.
A point towards any 3rd party libraries or standard implementations of this method would be great.
Thanks
You can do that sort of stuff with C# (probably only on Windows) because C# is from MS stables, the same stable that churns out doc and docx. I am not sure whether the same implementation would work on Linux or Mac (even with Mono).
If you want to achieve this in NodeJS, just create the app in C#, wrap it in a ReSTful cover and call this ReSTful service in NodeJS (via Kue or something similar).
Honestly, converting file formats is a compute intensive process process. I wouldn't recommend it doing it the same main thread any way. If you're anyway gonna spawn a worker, you might as well do it in C# where it's perhaps faster.
Not necessarily an exact match for your requirement, but since you mentioned training purpose, I would recommend Watson Developer Cloud - it has document conversion among many other features which may be relevant and useful for your objective as a whole.
Speaking of the current problem, please see Document conversion overview to see how we can convert a PDF into a desired format such as HTML. Then you could actually get the PNG files from the HTML resource bundle.
Hope this helps.

Resources