How to use ImageMagick with Alfresco? - image-processing

I know Alfresco uses imagemagick for preview of images however I want to use imagemagick when uploading images to ALfresco. So that only compressed images are stored in repository.
Any idea how can I achieve this either my manipulating configurations of Alfresco or I need to do it with some programming?
Thanks

You have a few options. First, you could write a rule which would be triggered when objects of a certain mimetype are added to a folder. Your custom rule code could then invoke a transformation to compress the image and then delete the source file. One drawback to this approach is that the original file does exist in the repo for a time. The second drawback is that you'd have to configure it on every folder. This tutorial explains how to write a custom rule action.
The second option would be to implement a behavior. Your custom behavior code can look for a node creation event and take action when it sees one happen. When it sees an image it could then invoke a transformation and replace the original. This tutorial explains how to write custom behaviors.
The third option would be to do a much lower level extension of the node service, so that the original object never actually gets created but is first compressed. That would be much more involved than either of the options above.

Related

Is there in Geogebra an API to load an image

In Geogebra you can insert an image interactively.
Is there any way to do this programmatically, i.e. just with a command, like InsertImage or LoadImage?
The construction protocol mentions only that the image was loaded without indicating the name of a relevant command or procedure.
No way. This interface is not provided in the official version.
Unless you modify the source code, which is possible because ggb is open source.

Appium get image file name of XCUIElementTypeImage

I'm using Appium for UI test my iOS application.
I want to know current image file name (asset name) loaded to UIImageView, because the image file changes dynamically by cases.
<XCUIElementTypeImage type="XCUIElementTypeImage" name="Accessbility id I set in Xcode" enabled="true" visible="false" accessible="false" x="668" y="498" width="17" height="17" index="1"/>
This is some portion of xml created by Appium.
I expected that a property like 'value' or 'image' or 'src' would appear in the xml code, but it didn't.
Is there any way to know image resource name?
While it would be a very dirty way to write your view, you could theoretically pass the image's filename as the accessibility ID. As you need to still identify the element you would still use the accessibility label to describe the element.
Why is this "dirty"? Your UIImageView contains an instance UIImage, not a file. The UIImage also does not store the filename, only the file's data. For this reason you'd have to get really messy about passing that filename around. This breaks a lot of view controller pattern rules.
This is not a good candidate for a UI test. Or if it is, not with Appium. Or if it is, with some sort of screenshot comparison tool (I've been out of Appium for a few years, but I'm sure you could make even an external tool work with enough effort).
Again, this seems like a lot of effort and that's always a red flag to me.
UI elements in Apple's XCTest don't contain original file meta-data. (See, for example, discussion here.)
Some people recommend to write unit tests if you need to check whether an image with specific name was assigned to a view object.
Other people store all images in the test bundle, automatically make partial screenshots of image views and compare their representations with stored images. (I personally am not sure how flaky it would be, but, IMO, the option is anyway too complicated.)
Another option might be to collect app screenshots in all states you want to check, and compare them with expected screenshots. I assume there are tools which can help automate this.

Load many pictures in a form

I was asked to develop a game called "Flag Quiz" in which the player have to guess the correct name of the flag that appears in the middle of the screen.
Of course I have a lot of pictures (221 flags) and I have to put them inside the program because, when the button Play is pressed, the program has to pick randomly 10 of these flags.
Problem
I was thinking to use an ImageList but the flags are 480x311 and so Delphi asks me to separate the picutre in 30 different bitmaps. Can I do anything about this?
My idea, to avoid that problem, was the following (although I think that it's not very good): create 221 TPicture components (invisible to the user of course) and load in each of them a picture of a flag.
I'd prefer not using the last idea I had. Do you know any improvement?
This sort of problem is simply not suited to the form designer. You want to store 221 images, and managing that in the IDE will be horrible. Once you've got them all in you won't be able to see them readily because they will be base 16 encoded in a .dfm file. Under revision control it will be a mess because you won't be able to change individual images in a manageable and traceable manner.
The accepted way to do this is to use resources. If it were me, I'd arrange for my images to have predicatable names. For instance, flag1, flag2, etc. I'd generate a resource script (.rc) that listed all the flags. I'd compile that resource script to a compiled resource (.res) which is linked to the executable. I'd have the resource script and the image files committed to revision control.
Then at runtime you have a single TImage control to display the flag. Every time you need a new image you load it with TResourceStream, and push it into the TImage control.
Devexpress has a Componnect named cximagecolletion that you can put your images on it and save and load images from/to file
or you can save all flags in small access db and load it when you need using tadodataset
there is no doubt that if you put your images direct on your form your dfm grow very high and so you Get Into trouble
Personally I would store each file as an image in a dedicated subdirectory, using the country as a file name. Then I would read the subdirectory file names on entry to the program (so I have a list of countries that I can randomly choose from) and use TImage.LoadFromFile to display the flag. This is far easier to extend than using a resource file (IMHO).

In org-mode, how do I keep the original path to images when using #+INCLUDE:?

I can use:
#+INCLUDE:
to include an org file in another org file, which allows me to assemble, say, a website from various org files. I'm exporting from the C-c C-e exporter in org-mode 7.5.
I could maintain a quite complex publication this way. This modular approach is quite common in, e.g. LaTeX and Texinfo publications.
However, links to images no longer work from the #+INCLUDEd org files. What seems to be happening is that the path to the images is taken as being from the org file that I am exporting from, rather than the actual org file that references the image.
The only ways I can see to resolve this are to:
use a flat file structure; or
make the image path from the referencing file (which I might not know in advance) rather than itself.
Neither of these is really sustainable.
How do I tell org to use the correct image path from its own relevant org file rather than the parent org file?
From what I know of the exporter, INCLUDE files are inserted into the document before export. Therefore the content is part of the document before it starts following paths to reach any links to files (images).
After a bit of testing you likely will need to use absolute file paths. Since you move between Windows and Linux your best bet would be to use a consistent scheme on both starting from your home directory.
Like that you can make the Org link:
[[~/path/to/image.jpg]], which will work on both systems (assuming you have set %HOME% on Windows).
Option 1 is potentially an alternative (although I agree it wouldn't be ideal at all), whereas the second option would have obvious pitfalls if you INCLUDE the file in more than one future document.

XML SDK 2.0 - Images - Excel file

With the use of the Open XML SDK 2.0, I did preformed the Reflected Code of an Excel file.
Along with other things, the Excel file has some images in some of the cells. When I run the code that was generated, the file show the images just fine.
What I need to do is to programatically inject images in place of the
images that are there now. The thing is, I cannot find where the images are at in the code that was generated. How can I figure this out? Also what is the easiest way to replace those images with new ones programmatically?
You may want to take a look at a similar question about inserting images into Excel files with OpenXML SDK: C# & OpenXML: Insert an image into an excel document.
Basically, those files are created as separate document parts. The answer I linked to should show You how to insert a new image into a document, however, in order to substitute existing images with your custom ones, you could probably just modify the binary data of appropriate ImagePart (and some other associated properties).
If You need some help with the code performing this task, let me know.

Resources