Looping over images with docxtemplater-image-module#3.1.0 - docxtemplater

I want to export an x amount of images coming from a dynamic array. How is it possible? So far it's only exporting the last value of the array.
I'm guessing something related to this but what am I missing?
images = [{image: image1, image: image2, image: image3...}]
{#images}
{%image}
{/images}

Related

Get Geometry of widgets with variable size

Situation
I have a pop_up widget (say a textbox), which I can place arbitrarily on the screen by setting the properties x and y accordingly.
On the other hand I use the prompt, which is located in the default wibar.
I would like to place the pop_up widget directly below the prompt
Problem
I was not yet able to gather any useful information about the geometry of the prompt. With geometry I mean its x and y values together with its height and width. I solved the y-positioning by using the height of the wibar itself.
But I am stuck with x-positioning.
Is there a way to get the width of the widgets within the toolbar?
Notice
I read something about forced_width, but in this situation it sounds like a hack to me. So I would prefer to avoid forcing any widths.
I'm currently running awesome WM 4.2 on Fedora 26
Part of a problem is that "a" widget does not have a position and size since awesome allows widgets to be shown in multiple places at once. However, if we just ignore this problem, something like the following could work (to be honest: I did not test this):
function find_widget_in_wibox(wb, widget)
local function find_widget_in_hierarchy(h, widget)
if h:get_widget() == widget then
return h
end
local result
for _, ch in ipairs(h:get_children()) do
result = result or find_widget_in_hierarchy(ch, widget)
end
return result
end
local h = wb._drawable._widget_hierarchy
return h and find_widget_in_hierarchy(h, widget)
end
However, I have to warn you that the above could break in newer versions of awesome since it access non-public API (the part with wb._drawable._widget_hierarchy). There is a way to work with just the public API using :find_widgets(), but I am too lazy for that for now.
The above function gets the wibox.hierarchy instance representing a widget which allows to get the geometry of the prompt via something like the following (in the default config of awesome 4.2):
local s = screen.primary -- Pick a screen to work with
local h = find_widget_in_wibox(s.mywibox, s.mypromptbox)
local x, y, width, height = h:get_matrix_to_device()
:transform_rectangle(0, 0, h:get_size())
local geo = s.mywibox:geometry()
x, y = x + geo.x, y + geo.y
print(string.format("The widget is inside of the rectangle (%d, %d, %d, %d) on the screen", x, y, width, height)
Finally, note that the widget hierarchy is only updated during repaints. So, during startup the code above will fail to find the widget at all and right after something changed (e.g. you entered another character into the promptbox), the above will still "figure out" the old geometry.

Why does my OBJ / MTL model material show up as black?

Why does my OBJ model have has no material and display as black?
I have an OBJ:
<a-obj-model id="gorilla" src="#gorilla-obj" mtl="#gorilla-mtl"></a-obj-model>
I can see the geometry, but the material shows up as black.
If you check your MTL, you might notice it is trying to use TGA or some other sort of textures that aren't plain images. In this case, you need to include additional three.js loaders.
You could try including all the necessary loaders like including https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/TGALoader.js and THREE.Loader.Handlers.add( /\.tga$/i, new THREE.TGALoader() );
However, it might be simplest to just batch convert all the TGAs to just use images like PNGs using a converter, and replace all instances of 'tga' with 'png'.

dhtmlx grid smartrender not work normally after sorting with splitAt mode

I use split mode and smartrender in dhtmlx grid. After I sort rows, rendered rows disappear and never come out on the right side, like the following picture.
after sorting, rows on right side could not be rendered anymore(click here to view the picture)
It's strange, rows on the left could be rendered when I scrolling on both sides.But rows on right side could not be rendered.
Anyone helps?
Thanks!
code structure:
var grid = new dhtmlXGridObject('#container');
grid.setImagePath("./bower_components/dhtmlxSuitePro/4.1.1/codebase/imgs/");
grid.enableTreeCellEdit(false);
grid.setHeader('...');
grid.attachHeader('...');
grid.setInitWidths('...');
grid.setColAlign('...');
grid.setColTypes('...');
grid.setColSorting('...');
grid.splitAt(2);
grid.enableSmartRendering(true);
grid.init();
grid.parse(data,'json'); // data is defined
Finally, after reading the docs again, I found grid.enableSmartRendering(true); should be after grid.init();
code following works:
var grid = new dhtmlXGridObject('#container');
grid.setImagePath("./bower_components/dhtmlxSuitePro/4.1.1/codebase/imgs/");
grid.enableTreeCellEdit(false);
grid.setHeader('...');
grid.attachHeader('...');
grid.setInitWidths('...');
grid.setColAlign('...');
grid.setColTypes('...');
grid.setColSorting('...');
grid.init();
grid.splitAt(2);
grid.enableSmartRendering(true);
grid.parse(data,'json'); // data is defined

Tile map isn’t loaded with some images

I made a tilemap. and used it on cocos2d-js.
Just added
this._map = new cc.TMXTiledMap(res.tilemap);
this.addChild(this._map, 0, 1);
in Layer.
But When I use this image,
http://i.imgur.com/f5VG0Nr.png,
http://i.imgur.com/Ugg9GNq.png
this error occured.
[.WebGLRenderingContext]RENDER WARNING: texture bound to texture
unit 0 is not renderable. It maybe non-power-of-2 and have incompatible
texture filtering or is not 'texture complete'
But When I used other image, it works.
like
http://i.imgur.com/Grv0srJ.png,
http://i.imgur.com/v1eWdkE.png,
http://i.imgur.com/BXKRbVx.png
I changed tilemap many times with that images, but same result.
I don't know what is diffrent that images.
Please help me.
Have you tried I believe I encountered this error once:
Have you tried adding all the image files in your resources.js file?

Drupal: imageField Crop: Suggest initial cropping?

Can I initialize the cropping area (In order to suggest a default one), with the Imagecrop module ?
I want my users to crop images in the same way...
thanks
Update: code lines in imagefield_crom.js
setSelect: [
parseInt($(".edit-image-crop-x", widget).val()),
parseInt($(".edit-image-crop-y", widget).val()),
parseInt($(".edit-image-crop-width", widget).val()) + parseInt($(".edit-image-crop-x", widget).val()),
300 + parseInt($(".edit-image-crop-y", widget).val())
]
Imagefield Crop uses the following jQuery plugin http://deepliquid.com/content/Jcrop_Manual.html
The function that you should be interested in is setSelect which sets the initial cropping area.
You can have a look in the file imagefield_crop.js (in the imagefield_crop module folder) where the function setSelect is being called. The default there is to set the selection area to the whole image -- you might want to recommend some other size and starting coordinates.
Alternative Answer
Check out http://drupal.org/project/imagecrop

Resources