Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@edifice.io/image-resizer
Advanced tools
The ImageResizer
class provides functionality to resize and compress image files. Below is an overview of its methods and usage.
changeDimension(height: number, maxHeight: number, width: number, maxWidth: number): { height: number; width: number }
This private static method adjusts the height and width of an image to fit within the specified maximum dimensions while maintaining the aspect ratio.
renameFileNameExtension(filename: string, newExtension: string): string
This private static method changes the file extension of a given filename to the specified new extension.
resizeImage(image: HTMLImageElement, fileName: string, maxWidth: number, maxHeight: number, compressFormat = "jpeg", quality = 80): Promise<File>
This private static method resizes an image to the specified dimensions and compresses it to the specified quality. It returns a promise that resolves to a File
object.
resizeImageFile(file: File, maxWidth: number = 1440, maxHeight: number = 1440, quality: number = 80): Promise<File>
This public static method resizes and compresses an image file. It returns a promise that resolves to the resized image file.
To use the ImageResizer
class, you can call the resizeImageFile
method with the image file and desired dimensions:
import ImageResizer from "./ImageResizer";
const fileInput = document.getElementById("fileInput") as HTMLInputElement;
fileInput.addEventListener("change", async (event) => {
const file = (event.target as HTMLInputElement).files?.[0];
if (file) {
try {
const resizedFile = await ImageResizer.resizeImageFile(
file,
800,
600,
70,
);
console.log("Resized file:", resizedFile);
} catch (error) {
console.error("Error resizing image:", error);
}
}
});
resizeImageFile
method only supports JPEG format for compression.FAQs
Edifice Image Resizer
We found that @edifice.io/image-resizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.