I have a problem,
in my RTE I resize images to a certain size, but after saving, they are reset to either width or height of 300. Smaller sizes are kept, only bigger ones are limited.
I know that there exists a maximum size, after some googleing, i found the following:
RTE.default.buttons.image.options.magic.maxWidth = 1000
RTE.default.buttons.image.options.magic.maxHeight= 1000
RTE.default.buttons.image.options.plain.maxWidth = 1000
RTE.default.buttons.image.options.plain.maxHeight= 1000
But also after inserting it to the PageTS, the images are limited to 300px.
Could someone with more Typo3 experience please help me?
Typo3 version is 6.1.7
I used tx_news and it was impossible to get images larger than 300px width.
I did RTE.default.buttons.image.options.magic.maxWidth = 1000 and styles.content.imgtext.maxWInText = 1000.
The problem is the setMagicImageMaximumDimensions in MagicImageService looks only for RTE.buttons.image.options.magic.maxWidth (no default).
So I have to use,
RTE.buttons.image.options.magic.maxWidth = 1000
There are more constants to define the maximal width of images:
Usage:
styles.content.imgtext {
maxW = XXX
maxWInText = YYY
}
You can also manipulate these widths using registers, which is very helpful to set these values to different values per column. The registers are called maxImageWidth and maxImageWidthInText respectively.
Related
Python 3.6.6, Pillow 5.2.0
The Google Vision API has a size limit of 10485760 bytes.
When I'm working with a PIL Image, and save it to Bytes, it is hard to predict what the size will be. Sometimes when I try to resize it to have smaller height and width, the image size as bytes gets bigger.
I've tried experimenting with modes and formats, to understand their impact on size, but I'm not having much luck getting consistent results.
So I start out with a rawImage that is Bytes obtained from some user uploading an image (meaning I don't know much about what I'm working with yet).
rawImageSize = sys.getsizeof(rawImage)
if rawImageSize >= 10485760:
imageToShrink = Image.open(io.BytesIO(rawImage))
## do something to the image here to shrink it
# ... mystery code ...
## ideally, the minimum amount of shrinkage necessary to get it under 10485760
rawBuffer = io.BytesIO()
# possibly convert to RGB first
shrunkImage.save(rawBuffer, format='JPEG') # PNG files end up bigger after this resizing (!?)
rawImage = rawBuffer.getvalue()
print(sys.getsizeof(rawImage))
To shrink it I've tried getting a shrink ratio and then simply resizing it:
shrinkRatio = 10485760.0 / float(rawImageSize)
imageWidth, imageHeight = pilImage.size
shrunkImage = imageToShrink.resize((int(imageWidth * shrinkRatio),
int(imageHeight * shrinkRatio)), Image.LANCZOS)
Of course I could use a sufficiently small and somewhat arbitrary thumbnail size instead. I've thought about iterating thumbnail sizes until a combination takes me below the maximum bytes size threshold. I'm guessing the bytes size varies based on the color depth and mode and (?) I got from the end user that uploaded the original image. And that brings me to my questions:
Can I predict the size in bytes a PIL Image will be before I convert it for consumption by Google Vision? What is the best way to manage that size in bytes before I convert it?
First all, you probably don't need to maximize to the 10M limit posed by Google Vision API. In most case, a much smaller file will be just fine, and faster.
In addition to that, you may want to keep in mind that the aspect ratio might lead to different result. See this, https://www.mlreader.com/prepare-image-for-google-vision-api
I am struggling to get my grid to reliably display its column widths evenly when using api.sizeColumnsToFit().
I have configured my grid to resize the columns when the parent div/browser window resizes:
this.gridOptions = <GridOptions>{
onModelUpdated: () => {
this.gridOptions.api.sizeColumnsToFit();
},
onGridSizeChanged: () => {
this.gridOptions.api.sizeColumnsToFit();
}
};
This works, but the resulting column widths are more often than not uneven. Please see the first and second day of the month for week 13 below:
Any suggestions to make this more reliable will be very welcome.
Here is a plnkr with a possible solution for you. In essence here is what you could do:
var windowWidth = document.querySelector('#myGrid').offsetWidth - 170 - 17,
// calculate the window width minus any columns you don't want to size for
and a little magic number for the vertical scrollbar (17 was for chrome on mac)
sizableColumns = gridOptions.columnApi.getColumnState().map(e=>e.colId).filter(e=>e!='athlete'),
// get the colId of only the columns that you want to resize
sizableColumnWidth = Math.floor(windowWidth/sizableColumns.length);
// calculate the width of each column by dividing the available width by the number of columns
sizableColumns.forEach(e=>gridOptions.columnApi.setColumnWidth(e,sizableColumnWidth))
// iterate through the columns you want to resize and set their new column width
However, I think that you might be better off by considering how many users are going to be resizing their browser windows... not only that but resizing their windows slowly multiple times. Check these posts:
http://davidgoss.co/2014/04/15/users-do-resize-their-browser-windows-take-2/
https://medium.com/#stephenkeable/do-users-resize-their-browser-windows-or-is-it-just-developers-and-designers-e1635cbae1e1
Both of these posts indicate that roughly 2% of desktop users are resizing their browsers. And a much smaller portion will be resizing their browsers slowly multiple times. Perhaps you simply tell these <1% to not resize their browsers like they do, or allow for the columns to be manually sized so that if they do notice this odd behavior they can resize the columns themselves.
Technical Note:
Your reported behavior is happening because the algorithm to size the columns to fit is quite sophisticated. It takes into account the relative sizes of all the columns and widens them appropriately, so if you had 4 columns sized 100, 200, 100; and you resized the window, then the middle column will still appear as twice the size of the others.
The algorithm is also placing whatever is leftover in pixels to the first column so if you have 9 columns and 100px to fit it into, 8 columns would be sized at 11 px and one would be sized at 12. That way the columns will truly "fit" and not leave a few pixels not filled by columns (like my suggested option)
TYPO3 crops the media files which were added as text & media. How can I disable this? I want that it uses the original file.
It always takes this:
fileadmin/_processed_/c/a/csm_herren2_b3373d24a3.png
Change the fluid template and remove the width and height attributes of the
Or maybe easier change the typoscript constant that define the max size to a higher value styles.content.textmedia.maxW = 600 and styles.content.textmedia.maxWInText = 300.
I am trying to upscaling an image which is inserted into the rte in Typo3 with the image button.
If I change the width to a lower one, it is working fine. Height is choosen automatically. But if I try to increase the width, the rte only save this changes if I manually add the right height.
In my PageTS I already have this:
RTE.default.buttons.image.options {
magic.maxWidth = 1000
magic.maxHeight = 1000
plain.maxWidth = 1000
plain.maxHeight = 1000
}
I configured
TYPO3_CONF_VARS[GFX][im_noScaleUp] = 0
Has anyone an idea if this is a bug? How can I make typo3 to upscale the image?
Is it possible to set maximal height of a picture in crystal report and preserve original ratio of a picture?
If can grow is disabled, every picture is streched or shrinked to default picture object size, if is enabled, I'm losing limits of picture size.
I'm using crystal reports for VS 2013 (13.0.5)
Actually I solved this problem for Visual Basic 5.0 and Crystal Reports 6.0 (Seagate version). You asked the newer version but maybe this gives you an idea to solve the problem or it may help some other guys searching an answer for their problems.
Before you assign the report source you can change the height of the picture:
Set crxFieldObject = Report.Sections.Item("D").ReportObjects.Item(269)
crxFieldObject.Height = theNewHeight
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
PS: After you assign the report source you can not change the height property. Below code does NOT work:
Private Sub Section3_Format(ByVal pFormattingInfo As Object)
Picture1.Height = theNewHeight 'this code does NOT work
End Sub
In this code:
.Sections.Item("D")means the Detail Section of the report and
.Item(269) means the Picture Object. After you insert an OLE Object you can check the item number with a small code such as:
aa = Report.Sections.Item("D").ReportObjects.Count
For i = 1 To aa
Set crxFieldObject = Report.Sections.Item("D").ReportObjects.Item(i)
bb = crxFieldObject.Name
If Mid(bb, 1, 7) = "Picture" Then
crxFieldObject.suppress = False 'You can put a BreakPoint here to check the value of i
End If
Next i
Hope it helps
The answer is No. I did many tests and researches and I didn't found any way to control the height and, without controlling the height, it's not possible to fit an arbitrary image in the object box and keep is ratio at the same time.
Looks like it's and old problem.
But if all your images are limited to the same dimensions, like you have set your limits to 500x500, so you can have, for example, images that do 500x200, 500x500, 250x500, etc., there's a way to do it.
The object box needs to have the same ratio as your limits. In my example, 500x500, the ratio is 1:1 (square) so your object box needs to be square also. You need to check Can grow and, in the Image tab, set the size exactly like the object box's size. You also have to set the bitmap image size (right-click on the box, choose Bitmap Image Object then Modify) to the image limits (500x500).
Perhaps too late, but when you right click on picture -> shaping of the object
You've a checkbox "modular size", uncheck it and put manually the size you want on Image tab.