Skip to content

Instantly share code, notes, and snippets.

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");
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 })
.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");
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"
/>
const items = [{
title: "May 1940",
contentTitle: "Dunkirk",
contentText:"Men of the British Expeditionary Force (BEF) wade out to a destroyer during the evacuation from Dunkirk.",
contentDetailedText: "On 10 May 1940, Hitler began his long-awaited offensive in the west...",
};
<div style={{ width: "500px", height: "400px" }}>
<chrono items={items} />
</div>
const data = [
{
title: "May 1940",
contentTitle: "Dunkirk",
contentText:
"Men of the British Expeditionary Force (BEF) wade out to a destroyer during the evacuation from Dunkirk.",
contentDetailedText: `On 10 May 1940, Hitler began his long-awaited offensive in the west by invading neutral Holland and Belgium and attacking northern France. Holland capitulated after only five days of fighting, and the Belgians surrendered on 28 May. With the success of the German ‘Blitzkrieg’, the British Expeditionary Force and French troops were in danger of being cut off and destroyed.
To save the BEF, an evacuation by sea was organised under the direction of Admiral Bertram Ramsay. Over nine days, warships of the Royal and French navies together with civilian craft, including the “little ships” made famous in a BBC broadcast by JB Priestley, successfully evacuated more than 338,000 British and Allied troops from the beaches of Dunkirk, in the remarkable Operation Dynamo. Churchill called it a
import React from "react";
import "./styles.css";
import { Chrono } from "react-chrono";
import data from "./data";
export default function App() {
return (
<div className="App">
<div style={{ width: "100%", height: "500px" }}>
<Chrono items={data} mode="HORIZONTAL" />
npx create-snowpack-app new-snowpack-app --template @snowpack/app-template-react --use-yarn