Skip to content

Instantly share code, notes, and snippets.

import React from "react";
import Skeleton from "react-loading-skeleton";
const imgUrl =
"https://cdn-images-1.medium.com/fit/c/50/50/1*Rhzd_aZYgwP2gocFecKi0Q.png";
export default function BlogPost({ title, body, subTitle }) {
return (
<div>
{body ? (
import React, { useState, useEffect } from "react";
import "./styles.css";
import BlogPost from "./BlogPost";
const blogPost = {
title: "Indrek Lasn Blog Post",
subTitle: "This is a subtitle for the skeleton loader",
body:
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
};
import React from "react";
import Skeleton from "react-loading-skeleton";
export default function BlogPost({ title, body, subTitle }) {
return (
<div>
<h1>{title || <Skeleton />}</h1>
<h3>{subTitle || <Skeleton />}</h3>
<p>{body || <Skeleton count={6} />}</p>
const sharp = require("sharp");
sharp("example-image.jpg")
.resize({ width: 500, height: 450 })
.flip()
.toFormat("png")
.png({ quality: 100 })
.toFile("flip-output.png");
const sharp = require("sharp");
sharp("example-image.jpg")
.resize({ width: 500, height: 450 })
.rotate(180)
.toFormat("png")
.png({ quality: 100 })
.toFile("rotate-output.png");
const sharp = require("sharp");
sharp("example-image.jpg")
.resize({ width: 500, height: 450 })
.toFormat("png")
.png({ quality: 100 })
.toFile("output.png");
const sharp = require("sharp");
sharp("example-image.jpg")
.resize({ width: 500, height: 450 })
.toFormat("png")
.png({ quality: 100 })
.toFile("output.png")
.then(() => {
// This is where you can either store the image to the database
const sharp = require("sharp");
const asyncSaveImageToDB = async () => {
try {
const image = await sharp("example-image.jpg")
.resize({ width: 500, height: 450 })
.toFormat("png")
.png({ quality: 100 })
.toFile("output.png");
const sharp = require("sharp");
sharp("example-image.jpg")
.resize({ width: 500, height: 450 })
.toFile("output.jpg");
<chrono
items={items}
mode="VERTICAL"
/>