This file contains 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
class Post | |
has_attached_file :asset, | |
:storage => :s3, | |
:processors => [:webp], | |
:url => ":s3_alias_url", | |
:path => ":id/:filename", | |
:s3_region => "your-region", | |
styles: { | |
webp: { | |
format: 'webp' |
This file contains 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
module Paperclip | |
# Paperclip processors allow you to modify attached files when they are | |
# attached in any way you are able. Paperclip itself uses command-line | |
# programs for its included Thumbnail processor, but custom processors | |
# are not required to follow suit. | |
# | |
# Processors are required to be defined inside the Paperclip module and | |
# are also required to be a subclass of Paperclip::Processor. There is | |
# only one method you *must* implement to properly be a subclass: | |
# #make, but #initialize may also be of use. #initialize accepts 3 |
This file contains 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
<picture> | |
<source type="image/webp" srcset="<%=@post.asset.url(:webp)%>"> | |
<source type="<%=@post.asset_content_type%>" srcset="<%=@post.asset.url%>"> | |
<img class="img-fluid img-center img-responsive" data-original="<%=@post.asset.url%>" alt="<%=@post.title%>" src=""/> | |
</picture> |
This file contains 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
<script id="amp-access" type="application/json"> | |
{ | |
"authorization": "/amp-access/authorization?rid=READER_ID&url=CANONICAL_URL&ref=DOCUMENT_REFERRER&_=RANDOM", | |
"pingback": "/amp-access/authorization?rid=READER_ID&url=CANONICAL_URL&ref=DOCUMENT_REFERRER&_=RANDOM", | |
"authorizationFallbackResponse": { | |
"error": true, | |
"loggedIn": false, | |
"powerUser": false | |
} | |
} |
This file contains 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
<section amp-access="loggedIn"> | |
<template amp-access-template type="amp-mustache"> | |
<amp-img src={{image}} width="29px" height="29px" class="round-logged-in-img"/>{{name}} | |
</template> | |
</section> |