Trying to figure out the image crop aspect ratio attribute, but can't make it working.
The code isL
protected function addUserFields()
{
$this->crud->addFields([
[
'name' => 'profile_image', // The db column name
'label' => trans('Profile image'), // Table column heading
'type' => 'image',
'upload' => true,
'crop' => true,
'aspect-ratio' => 1,
]);
}
It’s probably because you’re using a dash instead of underscore. It should be:
'aspect_ratio' => 1, // omit or set to 0 to allow any aspect ratio
Please also note what the docs say:
The value for aspect_ratio is a float that represents the ratio of the cropping rectangle height and width. By way of example,
Square = 1
Landscape = 2
Portrait = 0.5
And you can, of course, use any value for more extreme rectangles.
Related
I made a map for my Minetest Game I play.
The project is here : https://github.com/amelaye/aiwMapping I created the map with the Python script gdal2tiles, like this : ./gdal2tiles.py -l -p raster -z 0-10 -w none ../map.png ../tiles
Here is the interesting part of code :
var minZoom = 0
var maxZoom = 9
var img = [
20000, // original width of image
20000 // original height of image
]
// create the map
var map = L.map(mapid, {
minZoom: minZoom,
maxZoom: maxZoom
})
var rc = new L.RasterCoords(map, img)
map.setView(rc.unproject([9000, 10554]), 7)
L.control.layers({
'Spawn': layerGeoGlobal(window.geoInfoSpawn, map, rc, 'red', 'star', 'fa'),
}, {
'Bounds': layerBounds(map, rc, img),
}).addTo(map)
L.tileLayer('./tiles/{z}/{x}/{y}.png', {
noWrap: true,
attribution: ''
}).addTo(map)
It works like a charm, but there is a problem : in Minetest, the coords (lat and lon) go to -10000 to 10000. In my Leaflet map, the coords still positive, then they go from 0 to 20000.
How can I solve this problem ?
CRS SIMPLE does not work.
PS : No relative questions have been posted, please read my message carefully.
When gdal2tiles is not given a georeferenced image (or a world file accompanying the image), it will assume that the (0,0) coordinate is at one of the corners of the image, and that one pixel equals one map unit (both horizontally and vertically).
Since your input image is a .png file, the most straightforward way of working around the issue will be creating an appropriate world file.
If your input image is map.png, create a new plain text file named map.pgw with the following contents...
1
0
0
1
-10000
-10000
...then run gdal2tiles.py again. Note that this worldfile assumes that one pixel equals one map unit, and the image's first corner is at the (-10000,-10000) coordinate.
I have a panel on my site that has a Google Visualization Chart (Table) with controls and custom style. I have trouble with setting column width - somehow no solution works. Where is my mistake?
My two solutions:
a) like in row 57/58 in the code:
data.setProperty(0, 0, 'style', 'width:150px;');
b) like line 134-145 in the code:
google.visualization.events.addListener(table, 'ready', function() {
google.visualization.events.addListener(table.getChart(), 'sort', setWidth);
setWidth();
});
function setWidth() {
var title = 'Field4';
var width = '500px';
$('.google-visualization-table-th:contains(' + title + ')').css('width', width);
}
Also I didn't find any solution for limiting row height. If you select one row (eg. with Field4 filter) then this one row will fill all the space. Is there a way to limit row size to the content only?
This is my code: https://jsfiddle.net/my7p01e8/2/
I am creating ODF Document using OpenOffice::OODoc module. I want to have a Horizontal Line/Rule after a Heading.
I have seen documentation but it has no solution for this problem. I even tried to insert a paragraph with border, but it leaves a vertical white space after top border and next line.
Any idea how can this be done?
I've noticed that there are two methods--which I'm aware of--to
accomplish this task. There's Insert > Horizontal Ruler or by applying
a bottom border to the a paragraph.
From what it appears, the "Horizontal Ruler" is just an image inserted
in the text. - OpenOffice forum
So I think you could use an image (which contains a line).
$document->createImageStyle
(
"NewImageStyle",
properties =>
{
'draw:luminance' => '20%',
'draw:color-inversion' => 'true'
}
);
$document->createImageElement
(
"Image1",
style => "NewImageStyle",
attachment => $newparagraph,
import => "path\to\rule.jpg"
);
I'm hoping someone can help me figure out what is either wrong or possible when plotting a chart using Chart::Gnuplot module and 'dots' in Perl.
Here is what I have for my dataset:
# RFE Chart object
my $chart_RFE = Chart::Gnuplot->new(
output => $out_file_RFE,
terminal => "png",
title => {
text => "Step ROCOF",
font => "arial, 12",
},
xlabel => $chart_xlabel,
ylabel => "ROCOF Error (Hz/s)",
legend => {
position => "outside top",
align => "left",
},
);
# RFE Dataset
$dataSet = Chart::Gnuplot::DataSet->new(
xdata => \#dataX,
ydata => \#dataY,
style => 'dots',
color => $COLORS[3],
title=> 'RFE',
);
I want the dots because I have lot of data points to graph. However, the legend of the graph it produces shows no dots next to the legend names. If I change style to 'points'
style => 'points',
the different points show up in the graph's legend. Is there a way to get the dots to show? I've zoomed in on the legend area wondering if maybe they were just small but nothing shows up. I've also tried setting the width => option but that doesn't do anything (as I suspect it wouldn't since it's for lines).
Anyone know if this is even possible?
There's no option to change the point size in the legend (or "key," as Gnuplot calls it) so you have to use a hack to achieve the desired effect.
First, plot your dataset using the dots style, but don't assign it a title; then plot a dummy dataset using a different style and assign a title:
use strict;
use warnings;
use Chart::Gnuplot;
my #x = map { rand } 0 .. 10_000;
my #y = map { $_ + 0.1 - rand 0.2 } #x;
my $chart = Chart::Gnuplot->new(
output => 'gnuplot.png',
legend => {
position => 'outside top',
align => 'left'
}
);
my $color = '#ff0000';
my $dataset = Chart::Gnuplot::DataSet->new(
xdata => \#x,
ydata => \#y,
style => 'dots',
color => $color
);
my $dummy = Chart::Gnuplot::DataSet->new(
ydata => [ 'inf' ],
style => 'points',
pointtype => 'fill-circle',
pointsize => 1,
title => 'foo',
color => $color
);
$chart->plot2d($dataset, $dummy);
Output:
Note that this has been asked elsewhere for the command line version of Gnuplot, but it's actually pretty difficult to create a dummy dataset that plots nothing with Chart::Gnuplot. Using a y-value of "inf" was the only thing I could get to work that didn't require knowing the range of your axes.
I am trying to create a Security Image from a text using the perl module GD:SecurityImage with the following object:
my $image = GD::SecurityImage->new(
width => 220,
height => 60,
lines => 5,
scramble => 1,
angle => 45,
gd_font => 'giant',
);
$image->create( normal => 'circle' );
$image->particle(30, 70);
But the text in resulted image doesn't have the text angled at 45 Degrees rather its random.
Also if i make scramble = 0 and have angle = 45, the text doesn't rotate at that angle, text is just default in the image as seen in the attach screen.
Please help me out, what am i doing wrong here?.
NOTE: Image is with scramble = 0;
Please note that you must have Math::Trig to rotate with GD, otherwise you get no rotation. You don't need that with the ImageMagick backend - try that. (And use TTF :))