Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@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
The npm package @edifice.io/image-resizer receives a total of 0 weekly downloads. As such, @edifice.io/image-resizer popularity was classified as not popular.
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.