frontend: resize heading pictures as thumb file
This commit is contained in:
parent
b387f011d8
commit
0bc42282aa
4 changed files with 14 additions and 4 deletions
|
@ -57,7 +57,7 @@ func resizePicture(importedPath string, rect image.Rectangle) error {
|
||||||
dst := image.NewRGBA(rect)
|
dst := image.NewRGBA(rect)
|
||||||
draw.CatmullRom.Scale(dst, rect, src, src.Bounds(), draw.Over, nil)
|
draw.CatmullRom.Scale(dst, rect, src, src.Bounds(), draw.Over, nil)
|
||||||
|
|
||||||
dstFile, err := os.Create(importedPath)
|
dstFile, err := os.Create(strings.TrimSuffix(importedPath, ".jpg") + ".thumb.jpg")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,16 @@ func resizePicture(importedPath string, rect image.Rectangle) error {
|
||||||
if err = jpeg.Encode(dstFile, dst, &jpeg.Options{100}); err != nil {
|
if err = jpeg.Encode(dstFile, dst, &jpeg.Options{100}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dstFile, err := os.Create(strings.TrimSuffix(importedPath, ".jpg") + ".thumb.jpg")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer dstFile.Close()
|
||||||
|
|
||||||
|
if err = jpeg.Encode(dstFile, src, &jpeg.Options{100}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -331,7 +331,7 @@ img {
|
||||||
margin-bottom: -15rem;
|
margin-bottom: -15rem;
|
||||||
}
|
}
|
||||||
.page-header h1 {
|
.page-header h1 {
|
||||||
text-shadow: 0 0 5px rgba(255,255,255,0.9)
|
text-shadow: 0 0 15px rgba(255,255,255,0.95), 0 0 5px rgb(255,255,255)
|
||||||
}
|
}
|
||||||
.page-header h1, .page-header h1 a {
|
.page-header h1, .page-header h1 a {
|
||||||
color: black;
|
color: black;
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
|
|
||||||
<div style="background-image: url({{ themes[current_theme].image }})" ng-if="(current_theme)" class="page-header">
|
<div style="background-image: url({{ themes[current_theme].image }})" ng-if="(current_theme)" class="page-header">
|
||||||
<div class="container text-primary" ng-cloak>
|
<div class="container text-primary" ng-cloak>
|
||||||
<h1><a ng-href="{{ themes[current_theme].urlid }}" ng-bind="themes[current_theme].name"></a></h1>
|
<h1 class="display-2"><a ng-href="{{ themes[current_theme].urlid }}" ng-bind="themes[current_theme].name"></a></h1>
|
||||||
<h2 ng-bind-html="themes[current_theme].authors"></h2>
|
<h2 ng-bind-html="themes[current_theme].authors"></h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="headerfade"></div>
|
<div class="headerfade"></div>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<div class="card-columns">
|
<div class="card-columns">
|
||||||
<div class="card niceborder excard" ng-repeat="(k,theme) in themes" ng-click="goTheme()" ng-class="{'border-success': my.team_id && theme.solved > 0, 'border-warning': theme.exercice_coeff_max > 1}">
|
<div class="card niceborder excard" ng-repeat="(k,theme) in themes" ng-click="goTheme()" ng-class="{'border-success': my.team_id && theme.solved > 0, 'border-warning': theme.exercice_coeff_max > 1}">
|
||||||
<div class="card-img-top theme-card" ng-show="theme.image" style="background-image: url({{ theme.image }})"></div>
|
<div class="card-img-top theme-card" ng-show="theme.image" style="background-image: url({{ theme.image.substr(0, theme.image.length-3) }}thumb.jpg)"></div>
|
||||||
<div class="card-body text-indent">
|
<div class="card-body text-indent">
|
||||||
<h5 class="card-title">
|
<h5 class="card-title">
|
||||||
<a ng-href="{{ theme.urlid }}">{{ theme.name }}</a>
|
<a ng-href="{{ theme.urlid }}">{{ theme.name }}</a>
|
||||||
|
|
Reference in a new issue