Why is that though? Is there not a way that doesn't require me to edit the image and rather just upload it without it cropping? If i were to upload the image as an avatar, it wouldn't crop? Shouldn't it be the same?After testing this and inspecting the code, this is working as intended. The icons all need to be the same size, and the image uploader will resize and/or crop images to make them fit the specified dimensions. Your image is 192x120, which means the width will be cropped to fit 120 pixels.
If you add padding to your image so that it becomes 192x192, it will no longer be cropped, assuming your image dimensions are set to equal width/height.
So there isn't a way for me other than editing the image itself?The reason why it's not the same is the fact that this add-on allows you to control both the width and the height of images.
When you specify both a maximum width and maximum height to XF's image processor, it will crop images if needed. Avatars specify only one maximum size, meaning XF's image processor will resize images until both dimensions fit the maximum size.
It was specifically requested to be allowed to specify both maximum width and maximum height, so I can't change that as it would break image processing for other users.
In other words, leaving the "height" field blank when uploading icons will resize only the width.Change: If the item icon height is not specified, resize only the width of the icon
Ok. I will test this out and see how it works. I kind of get the idea but will need to see it for myself to understand it.In the next version I've made an undocumented change:
In other words, leaving the "height" field blank when uploading icons will resize only the width.
This will break the front-end display, as it requires both width and height to be specified, but you can apply the "height" field once you're done uploading icons.
src/addons/DBTech/Shop/Service/Item/Icon.php
and find $image->resizeAndCrop($targetWidth, $targetHeight);
then replace with $image->resizeWidth($targetWidth);
- you won't need to change the width/height settings by making that edit.That worked perfectly. Thank you!There's no ETA. If you want to edit the files earlier, opensrc/addons/DBTech/Shop/Service/Item/Icon.php
and find$image->resizeAndCrop($targetWidth, $targetHeight);
then replace with$image->resizeWidth($targetWidth);
- you won't need to change the width/height settings by making that edit.
We use essential cookies to make this site work, and optional cookies to enhance your experience.