
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@prass/betterimage
Advanced tools
BetterImage is a Next.js-focused library for building optimized image components with advanced features, including fallback animations. It enhances Next.js's built-in Image component, offering seamless optimization and an improved user experience for your
BetterImage is a Next.js-focused library for building optimized image components with advanced features, including fallback animations. It enhances Next.js's built-in Image component, offering seamless optimization and an improved user experience for your projects.
Image component for automatic optimizations like lazy loading, responsive resizing, and image format selection.BetterImage component into your project for consistent and optimized image handling.Install betterimage using npm or yarn:
npm install @prass/betterimage
# or
yarn add @prass/betterimage
BetterImage is designed for Next.js projects. Simply replace the Next.js Image component with the BetterImage component.
import { BetterImage } from "@prass/betterimage/components";
export default function Example() {
return (
<BetterImage
src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&w=600"
alt="Example Image"
width={600}
height={900}
onFailString="Example Image"
/>
);
}
BetterImage extends the Next.js Image component and includes additional props:
| Prop | Type | Description |
|---|---|---|
onFailString | string | Fallback string to display if the image fails to load. |
delay | number | Delay rendering for users with slower connections, to improve performance. |
Other Props | ...ImageProps | All standard Next.js Image props are supported (e.g., src, alt, width, etc.) |
BetterImage is highly customizable. You can create your own components based on your project needs.
import * as BetterThings from "@prass/betterimage";
import { pras } from "@prass/betterimage/lib";
const BetterVersion = React.forwardRef(({ className, ...props }, ref) => (
<BetterThings.Root
ref={ref}
className={pras("relative flex h-full w-full", className)}
{...props}
/>
));
BetterVersion.displayName = BetterThings.Root.displayName;
const Img = React.forwardRef(({ className, ...props }, ref) => (
<BetterThings.Image
ref={ref}
className={pras("h-full w-full", className)}
{...props}
/>
));
Img.displayName = BetterThings.Image.displayName;
const Fallback = React.forwardRef(({ className, ...props }, ref) => (
<BetterThings.Fallback
ref={ref}
className={pras(
"flex h-full w-full items-center justify-center",
className
)}
{...props}
>
<Loader className="h-4 w-4 animate-spin" />
</BetterThings.Fallback>
));
Fallback.displayName = BetterThings.Fallback.displayName;
export { BetterVersion, Img, Fallback };
BetterImage simplifies image handling in your Next.js projects with:
This project is licensed under the MIT License.
Contributions are welcome! If you find any bugs or have suggestions, feel free to open an issue or submit a pull request.
Elevate your Next.js image components with BetterImage! 🚀
FAQs
BetterImage is a Next.js-focused library for building optimized image components with advanced features, including fallback animations. It enhances Next.js's built-in Image component, offering seamless optimization and an improved user experience for your
We found that @prass/betterimage demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.