Skip to content

Commit

Permalink
feat: add resizer
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Jan 27, 2019
1 parent 30268a2 commit 2aa3738
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
static/img/cache
.DS_Store
*~
.#*
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module ultre.me/calcbiz

require (
github.com/disintegration/imaging v1.5.0
github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687
github.com/gobuffalo/packr v1.21.9
github.com/gogo/gateway v1.0.0
Expand Down Expand Up @@ -31,6 +32,8 @@ require (
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
golang.org/x/image v0.0.0-20190118043309-183bebdce1b2 // indirect
golang.org/x/net v0.0.0-20190110044637-be1c187aa6c6
google.golang.org/appengine v1.2.0 // indirect
google.golang.org/genproto v0.0.0-20190108161440-ae2f86662275
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/disintegration/imaging v1.5.0 h1:uYqUhwNmLU4K1FN44vhqS4TZJRAA4RhBINgbQlKyGi0=
github.com/disintegration/imaging v1.5.0/go.mod h1:9B/deIUIrliYkyMTuXJd6OUFLcrZ2tf+3Qlwnaf/CjU=
github.com/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
Expand Down Expand Up @@ -364,6 +366,8 @@ golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/image v0.0.0-20190118043309-183bebdce1b2 h1:FNSSV4jv1PrPsiM2iKGpqLPPgYACqh9Muav7Pollk1k=
golang.org/x/image v0.0.0-20190118043309-183bebdce1b2/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
28 changes: 14 additions & 14 deletions pkg/crew/crew.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var CALC = Crew{
Key: "sbrk",
Name: "sbrk.org",
Description: "gentil",
ImageURL: "/img/copaings/sbrk.jpg",
ImageURL: "./static/img/copaings/sbrk.jpg",
Links: []*Link{
{
Name: "Sbrk",
Expand All @@ -52,7 +52,7 @@ var CALC = Crew{
Key: "m1ch3l",
Name: "m1ch3l",
Description: "m1ch3l est cool, m1ch3l aime les gommes.",
ImageURL: "/img/copaings/m1ch3l.jpg",
ImageURL: "./static/img/copaings/m1ch3l.jpg",
Links: []*Link{
{
Name: "Le site de m1ch3l",
Expand All @@ -68,7 +68,7 @@ var CALC = Crew{
Key: "salutcestcool",
Name: "salut c'est cool",
Description: "<3<3<3<3",
ImageURL: "/img/copaings/scc.jpg",
ImageURL: "./static/img/copaings/scc.jpg",
Links: []*Link{
{
Name: "Le site de les saluts",
Expand All @@ -84,7 +84,7 @@ var CALC = Crew{
Key: "garscool",
Name: "Gars Cool",
Description: "je suis cool",
ImageURL: "/img/copaings/garscool.jpg",
ImageURL: "./static/img/copaings/garscool.jpg",
Links: []*Link{
{
Name: "Facebook",
Expand All @@ -104,7 +104,7 @@ var CALC = Crew{
Key: "cestmoi",
Name: "C'est moi",
Description: "hihi",
ImageURL: "/img/copaings/cestmoi.jpg",
ImageURL: "./static/img/copaings/cestmoi.jpg",
Links: []*Link{
{
Name: "Facebook de C'est moi",
Expand All @@ -116,7 +116,7 @@ var CALC = Crew{
Key: "pardonmyfrench",
Name: "Pardon My French",
Description: "je voudrais une croissant",
ImageURL: "/img/copaings/pardonmyfrench.jpg",
ImageURL: "./static/img/copaings/pardonmyfrench.jpg",
Links: []*Link{
{
Name: "Site officiel",
Expand All @@ -128,7 +128,7 @@ var CALC = Crew{
Key: "furrtek",
Name: "Furrtek",
Description: "Avant on se faisait electrocuter, maintenant on peut se faire electroniquer",
ImageURL: "/img/copaings/furrtek.png",
ImageURL: "./static/img/copaings/furrtek.png",
Links: []*Link{
{
Name: "Site officiel",
Expand All @@ -144,7 +144,7 @@ var CALC = Crew{
Key: "tahigo",
Name: "Tahigo",
Description: "Rock festif",
ImageURL: "/img/copaings/tahigo.jpg",
ImageURL: "./static/img/copaings/tahigo.jpg",
Links: []*Link{
{
Name: "Facebook",
Expand All @@ -160,7 +160,7 @@ var CALC = Crew{
Key: "spreadshirt",
Name: "Spreadshirt",
Description: "Des produits CALC",
ImageURL: "/img/copaings/spreadshirt.jpg", // FIXME: make random
ImageURL: "./static/img/img-not-found-400.png", // FIXME: make random
Links: []*Link{
{
Name: "Des T-shirts",
Expand All @@ -172,7 +172,7 @@ var CALC = Crew{
Key: "estcequecestbientotlapero",
Name: "Est-ce que c'est bientôt l'apéro ?",
Description: "Outil ludique",
ImageURL: "/img/copaings/apero.jpg",
ImageURL: "./static/img/copaings/apero.jpg",
Links: []*Link{
{
Name: "Outil",
Expand All @@ -184,7 +184,7 @@ var CALC = Crew{
Key: "leclubdegym",
Name: "Le club de Gym",
Description: "Collectif d'artistes et de muscles",
ImageURL: "/img/copaings/club.jpg",
ImageURL: "./static/img/copaings/club.jpg",
Links: []*Link{
{
Name: "Facebook",
Expand All @@ -196,7 +196,7 @@ var CALC = Crew{
Key: "leonard",
Name: "Léonard Gordon Alain Souchon de la Gomme du Camembert",
Description: "Waf.",
ImageURL: "/img/copaings/leonard.jpg",
ImageURL: "./static/img/copaings/leonard.jpg",
Links: []*Link{
{
Name: "Facebook",
Expand All @@ -212,7 +212,7 @@ var CALC = Crew{
Key: "jesuispasunmonstre",
Name: "Je suis pas un monstre !",
Description: "par Sassou Youpi",
ImageURL: "/img/copaings/sassou-behance.jpg",
ImageURL: "./static/img/copaings/sassou-behance.jpg",
Links: []*Link{
{
Name: "Behance",
Expand All @@ -224,7 +224,7 @@ var CALC = Crew{
Key: "vadim",
Name: "Vadim",
Description: "Pipi",
ImageURL: "/img/copaings/apokorounta.png",
ImageURL: "./static/img/copaings/apokorunta.png",
Links: []*Link{
{
Name: "Apokorunta",
Expand Down
18 changes: 9 additions & 9 deletions pkg/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,71 +50,71 @@ func (d *Dashboard) hackEntries(limit int) (*Entries, error) {
entries.append(NewManualEntry(
"Moi j'aime",
"hackz/moijaime",
"/img/hackz/moijaime/logo.jpg",
"./static/img/hackz/moijaime/logo.jpg",
"Générateur de phrase de moi j'aime",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"3615cryptage",
"hackz/3615cryptage",
"/img/hackz/3615cryptage/logo.jpg",
"./static/img/hackz/3615cryptage/logo.jpg",
"Messages codés de James Bond",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"Des Phazms",
"hackz/phazms",
"/img/hackz/phazms/logo.jpg",
"./static/img/hackz/phazms/logo.jpg",
"Pokedex de phazms",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"Calculatrice.exe",
"hackz/calculatrice.exe",
"/img/hackz/calculatrice/logo.jpg",
"./static/img/hackz/calculatrice/logo.jpg",
"Pour faire des mathématiques ou d'autres sciences",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"Recettator",
"hackz/recettator",
"/img/hackz/recettator/logo.jpg",
"./static/img/hackz/recettator/logo.jpg",
"Des recettes équilibrés et festives",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"Paint",
"hackz/paing",
"/img/hackz/paint/logo.jpg",
"./static/img/hackz/paint/logo.jpg",
"Paint.exe en mode MMORPG",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"Ultreme Tetris",
"hackz/ultreme-tetris",
"/img/hackz/tetris/logo.jpg",
"./static/img/hackz/tetris/logo.jpg",
"Pour les balèzes",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"m1ch3l",
"hackz/m1ch3l",
"/img/hackz/m1ch3l/logo.jpg",
"./static/img/hackz/m1ch3l/logo.jpg",
"Le meilleur d'entre nous",
Entry_Hack,
false,
))
entries.append(NewManualEntry(
"2048",
"hackz/2048",
"/img/hackz/2048/logo.jpg",
"./static/img/hackz/2048/logo.jpg",
"de 7 à 77 ans",
Entry_Hack,
false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/random/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var alternateLogos = []string{

func AlternateLogo() string {
file := alternateLogos[rand.Intn(len(alternateLogos))]
return fmt.Sprintf("/img/logo-alternate-300/%s", file)
return fmt.Sprintf("./static/img/logo-alternate-300/%s", file)
}

func MotDebileQuiSeMange() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/soundcloud/soundcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func fromSoundcloudTracks(input []*gosoundcloud.Track) *Tracks {

func artworkURL(input string) string {
if input == "" {
return "/img/img-not-found-400.png"
return "./static/img/img-not-found-400.png"
}
return strings.Replace(input, "-large", "-t500x500", -1)
}
Expand Down
Empty file added static/img/cache/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion templates/copaings.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{ end }}
</div>
</div>
<img src="{{ $copain.ImageURL | cache_external_assets | resize (printf "%dx%d" $square_size $square_size) "fill=1" }}"
<img src="{{ $copain.ImageURL | resize (printf "fill=%dx%d" $square_size $square_size) }}"
class="img-responsive" width="{{$square_size}}" height="{{$square_size}}" />
</div>
</div>
Expand Down
25 changes: 1 addition & 24 deletions templates/hackz.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{ $entry.Title }}
</p>
</div>
<img src="{{ $entry.ImageURL | cache_external_assets | resize "250x250" "fill=1" }}"
<img src="{{ $entry.ImageURL | resize "fill=250x250" }}"
class="img-responsive"
width="{{$square_size}}" height="{{$square_size}}" />
</a>
Expand All @@ -35,30 +35,7 @@
<p class="well">Et plein d'autres..</p>
{{end}}


{{/*
{% block main_column %}
<div class="row">
{% for hack in hackz : %}

<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 rotate-random">
<a href="{{ hack.url }}" class="thumbnail"
width="{{square_size}}" height="{{square_size}}">
<div class="caption-wrapper">
<p class="caption">
{{ hack.title }}
</p>
</div>
<img width="{{square_size}}" height="{{square_size}}" class="img-responsive"
src="{{ hack.img | cache_external_assets | resize('250x250', fill=1) }}"
/>
</a>
</div>

{% endfor %}
</div>
{% endblock %}

{% block secondary_column %}
<h2>Hackzers les plus {{ mot_cool() }} <small>(pour l'instant !)</small></h2>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion templates/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{ $entry.Title }}
</p>
</div>
<img src="{{ $entry.ImageURL | cache_external_assets | resize "250x250" "fill=1" }}"
<img src="{{ $entry.ImageURL | resize "fill=250x250" }}"
class="img-responsive"
width="{{$square_size}}" height="{{$square_size}}" />
</a>
Expand Down
4 changes: 2 additions & 2 deletions templates/layout/base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@
<hr class="hidden-md hidden-lg" />
<div class="col-xs-6 col-sm-6 col-md-12 col-lg-12">
<a href="/">
<img src="{{ "/img/logo-300.png" | resize "300x300" "fill=1"}}"
<img src="{{ "./static/img/logo-300.png" | resize "fill=300x300" }}"
class="bicool img-responsive img-rounded"
data-alternate="{{ logo_alternate | resize "300x300" "fill=1" }}"
data-alternate="{{ logo_alternate | resize "fill=300x300" }}"
title="Camembert au lait crew" width="300" height="300" />
</a>
<!--<hr class="hidden-sm hidden-xs" /> -->
Expand Down
Loading

0 comments on commit 2aa3738

Please sign in to comment.