<img
src={this.props.src}
alt={this.alt()}
+ title={this.alt()}
loading="lazy"
- className={classNames({
+ className={classNames("overflow-hidden pictrs-image", {
"img-fluid": !this.props.icon && !this.props.iconOverlay,
banner: this.props.banner,
- "thumbnail rounded":
+ "thumbnail rounded object-fit-cover":
this.props.thumbnail && !this.props.icon && !this.props.banner,
"img-expanded slight-radius":
!this.props.thumbnail && !this.props.icon,
"img-blur": this.props.thumbnail && this.props.nsfw,
- "rounded-circle img-icon mr-2": this.props.icon,
- "ml-2 mb-0 rounded-circle avatar-overlay": this.props.iconOverlay,
+ "object-fit-cover img-icon me-1": this.props.icon,
+ "ms-2 mb-0 rounded-circle object-fit-cover avatar-overlay":
+ this.props.iconOverlay,
"avatar-pushup": this.props.pushup,
})}
/>
// sample url:
// http://localhost:8535/pictrs/image/file.png?thumbnail=256&format=jpg
- let split = this.props.src.split("/pictrs/image/");
+ const split = this.props.src.split("/pictrs/image/");
// If theres not multiple, then its not a pictrs image
if (split.length == 1) {
return this.props.src;
}
- let host = split[0];
- let path = split[1];
+ const host = split[0];
+ const path = split[1];
- let params = { format };
+ const params = { format };
if (this.props.thumbnail) {
params["thumbnail"] = thumbnailSize;
params["thumbnail"] = iconThumbnailSize;
}
- let paramsStr = new URLSearchParams(params).toString();
- let out = `${host}/pictrs/image/${path}?${paramsStr}`;
+ const paramsStr = new URLSearchParams(params).toString();
+ const out = `${host}/pictrs/image/${path}?${paramsStr}`;
return out;
}