This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sharp = require("sharp"); | |
sharp("example-image.jpg") | |
.resize({ width: 500, height: 450 }) | |
.rotate(180) | |
.toFormat("png") | |
.png({ quality: 100 }) | |
.toFile("rotate-output.png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sharp = require("sharp"); | |
sharp("example-image.jpg") | |
.resize({ width: 500, height: 450 }) | |
.toFormat("png") | |
.png({ quality: 100 }) | |
.toFile("output.png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sharp = require("sharp"); | |
sharp("example-image.jpg") | |
.resize({ width: 500, height: 450 }) | |
.toFile("output.jpg"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<chrono | |
items={items} | |
mode="VERTICAL" | |
/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npx create-snowpack-app new-snowpack-app --template @snowpack/app-template-react --use-yarn |