TYPO3 Fluid: f:image trim image then scale - typo3

I have a square image of 1200x1200px. Now I want to cut off / trim all sides by 80px and then scale it down to 275px. How is this possible?
<f:image src="path/to/image.jpg" width="275c" />
This just scales down the image, so I took a look at the imgResource Core Documentation that told me, you can crop images by substracting x percent.
<f:image src="path/to/image.jpg" width="1120c-93" height="1120c-93" />
93% of 1200px are roughly 1120px.
Next try was to first crop, then scale, but it seems that I'm not able to trim a square image at all.
<f:image src="{f:uri.image(src: 'path/to/image.jpg', width: '1200c-93')}" width="275" />
Does anyone have any suggestions how to solve the problem?
Edit
So I tried the following with fixed width and height:
<f:image src="{f:uri.image(src: '{item.imagePath}image_001.jpg', width: '1120c-50', height: '1120c-50')}" width="275" height="275" alt="{item.name}" />
<f:image src="{item.imagePath}image_001.jpg" alt="{item.name}" width="275" alt="{item.name}" />
But this gives me two identical images: http://img545.imageshack.us/img545/204/nsuo.png

You have to specify an explicit height in the inner call and the crop values must be smaller than the original image size. So try this one:
<f:image src="{f:uri.image(src: 'path/to/image.jpg', width: '1120c-93', height: '1120c-93')}" width="275" alt="" />

Related

.NET MAUI How to set CollectionView items Padding to 0

I can't set padding to 0 in items of CollectionView in MAUI.
In this example, I use Data and Data[i].Color as follow:
<CollectionView
ItemsSource="{Binding Data}"
ItemSizingStrategy="MeasureFirstItem"
ItemsLayout="HorizontalList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Button
Clicked="Button_Clicked"
WidthRequest="10"
HeightRequest="10"
BackgroundColor="{Binding Color}" />
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
My Buttons has Width 10 and Height 10, and there is space between my Buttons. Only set Button Width more than 100 can I see no space between my Buttons, but 100 is too large.
I tried to set Padding or Margin in Button, and WidthRequest in CollectionView, but it didn't work.
How can I remove the space?
I tried ItemSpacing:
<CollectionView.ItemsLayout>
<LinearItemsLayout
Orientation="horizonal"
ItemSpacing="0" />
</CollectionView.ItemsLayout>
But fail.
You want to set the space between buttons to 0 in CollectionView. And this is a known issue and it's been tracked in Windows CollectionView ItemSpacing is not working. When setting the property ItemSpacing to 0, the space between the items should have been reduced to 0, however it doesn't work as expected.
For more details, you can refer to MAUI: How to reduce spacing between buttons.

How can I offset a MUI Popover component from an anchorEl?

With anchorOrigin, I can give a MUI Popover an offset with anchorPosition.top and anchorPosition.left. But this has no effect when I'm using an anchorEl (i.e., attaching the popover to a trigger element), not an anchorOrigin (i.e., using absolute positioning).
It seems I can do this with the MUI Popper
(see this issue), but not very easily with the popover. I want the clickaway functionality so apart from this positioning difficulty I prefer the popover.
What's the best way to attach to an element but shift the popover (say, down and right)?
You can just pass a number to the horizontal and vertical properties to have them offset with respect to the top-left corner of the anchor element, like this:
<Popover
id={id}
open={open}
anchorEl={anchorEl}
onClose={handleClose}
anchorOrigin={{
vertical: 'bottom',
horizontal: 100,
}}
>
<Typography sx={{ p: 2 }}>The content of the Popover.</Typography>
</Popover>
this will open the popover 100 pixels to the right of the left margin of the anchorEl.

Adjusting CFWindow position on the screen, is it possible?

I try to use cfwindow to deliver an error/warning message to my users. It works but the only problem is the pop up window is off the screen all the way to the bottom sinking to the task bar.
I thought I can use the x and y attributes but I tried them and they did not work.
Is it possible to adjust the positioning of cfwindow at all so when it shows up it will be in the middle of the screen or at least in the middle up instead of sinking down below?
<CFTRY>
<cffile action="upload" filefield="uploadfile" destination="#TempDestination#" nameConflict="overwrite" result="myupload">
<cfdump var="#myupload#">
<CFCATCH type="Any">
<cfwindow initShow="true" title="Minute Upload Problem" center="true" height="200" width="400"
x="880" y="850"
bodyStyle="font-family: verdana; color: ##000000; font-size: 13;"
headerStyle="font-family: verdana; background-color: ##ff0000; color: ##ffffff"
resizable="False" name="NoPermission">
<!--- message --->
<div align="center">
Destination Folder may not be set to accept your file<br>
Please contact the webmaster.
</div>
</cfwindow>
</CFCATCH>
</CFTRY>
To fit the window as per x & y coordinates, you will have to set
center="false"
If center is set to true, then it will take precedence over the x & y coordinates. I have set center="false". Now, the position of the new popup windows changes, as I change the x & y coordinates.

Dojox Datagrid, add span to every cell to make css nowrap to work in IE7

Since nowrap on td element doesn't seems to work in IE, see this question, I am in desperate need of help how to add a span element with nowrap to every cell in a Dojox Datagrid without having to define field formatters to accomplish this.
See jsfiddle here http://jsfiddle.net/HkxHZ/4/
Using this css I get what I want in Chrome and FF, i.e. no word wrap and overflow hidden. But it doesn't work in IE..
<style type="text/css">
.dojoxGridRowTable {
table-layout: fixed;
width: 0px;}
.dojoxGrid .dojoxGridCell {
text-align: left;
overflow:hidden;
white-space:nowrap;}
</style>​
This method is like auto-size in that is will make the width of each column in the DataGrid big enough to show your data with no wrapping.
What you should do is calculate the proper width for each column of the grid layout based on PX size of the text in the column description and data for that column. This should be done before creating the grid layout.
Here is how you get the proper width in px. Add the following html to your page:
css:
#test
{
position: absolute;
visibility: hidden;
height: auto;
width: auto;
}
<div id="test"></div>
1) Get the font size used in your DataGrid
2) Get the div object and set the font size to what is used in the grid
<div id="test"></div>
var tst_item = window.document.getElementById("test");
tst_item.style.fontSize = grid_fnt_sz;
3) Place each column description and data item intended for your DataGrid into the hidden div:
tst_item.innerHTML = "Your data";
var widthPX = (tst_item.clientWidth + 1); //Width of text in PX
Store this widthPX in an array for each column keeping only the largest found for the column.
4) When creating the layout for your grid, set the width for the column to the largest width from your column description and data for that column.
This method ensures that width of each column will be big enough to show your data without wrapping. Depending on your needs, you can tweek the logic to do what you need. This might not be feasible with large amounts of data. But, it works great for me.

Two LineSeries with the same Y Axis in WPF Toolkit charts

I want to do the following with the WPF toolkit charts:
I have two line series that should use the same y axis (i.e I want them both to be on the same scale). I could give each of them the same axis definition so they would overlap (and then have one of them with collapsed visibility), but that is not my best choice.
This is the solution I'm talking about:
<charts:LineSeries Name="ExternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding ExternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Red"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for external measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Title="Measurement"
Minimum="0"
Maximum="30"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
<charts:LineSeries Name="InternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding InternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Orange"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for internal measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Minimum="0"
Maximum="30"
Visibility="Collapsed"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
Is there a way to define more than one series with the same Y axis?
I found that toolkit version 3.5.0.0 has something called StackedLineSeries but that version 3.5.40128.1 which is what gets installed in the February 2010 version of the toolkit, it isn't there. Did it move to another clr-namespace?
I faced the same issue and found the following way around. You can add the two series to the same chart and hide the second series Axis label by setting the Width to 0;
<charts:LinearAxis
Orientation="Y"
Title="Measurement"
Minimum="0"
Maximum="30"
**Width = "0"**
/>
Hope this helps
I have a chart with 3 line series. The first 2 series represent the relative humidity and the third one represent the dew point.
I want to draw the first 2 series on the same Y axis. I created my axes in a resource section. In my example, this is in a TabItem.
<TabItem Header="rH">
<TabItem.Resources>
<chartingToolkit:LinearAxis Orientation="Y" HorizontalAlignment="Left" Title="rH /%" x:Key="RHYAxis" />
<chartingToolkit:LinearAxis Orientation="Y" HorizontalAlignment="Right" Title="Dew point /°C" x:Key="DewPointYAxis" />
</TabItem.Resources>
<chartingToolkit:Chart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Title="Relative Humidity" IsEnabled="True">
<chartingToolkit:Chart.Series>
<chartingToolkit:LineSeries DependentRangeAxis="{StaticResource RHYAxis}" IsSelectionEnabled="False" ItemsSource="{Binding Path=RHCollection}" IndependentValuePath="TimeStamp" DependentValuePath="rH" Title="Measured rH" />
<chartingToolkit:LineSeries DependentRangeAxis="{StaticResource RHYAxis}" IsSelectionEnabled="False" ItemsSource="{Binding Path=CorrectedRHCollection}" IndependentValuePath="TimeStamp" DependentValuePath="CorrectedRH" Title="Corrected rH" />
<chartingToolkit:LineSeries DependentRangeAxis="{StaticResource DewPointYAxis}" IsSelectionEnabled="False" ItemsSource="{Binding Path=DewPointCollection}" IndependentValuePath="TimeStamp" DependentValuePath="DewPoint" Title="Dew point" />
</chartingToolkit:Chart.Series>
</chartingToolkit:Chart>