user blog image tweaks

pull/9705/head
Thibault Duplessis 2021-09-01 21:48:35 +02:00
parent 340ae47362
commit 06a89da3e3
4 changed files with 3 additions and 12 deletions

View File

@ -98,10 +98,7 @@ object post {
imageUrlOf(post) match {
case Some(url) => baseImg(src := url)
case _ =>
baseImg(
heightA := height,
src := assetUrl("images/placeholder.png")
)
baseImg(src := assetUrl("images/placeholder-500.png"))
}
def imageUrlOf(post: UblogPost, height: Int = defaultImageHeight) = post.image map { i =>

View File

@ -20,7 +20,6 @@ case class PicfitImage(
// unique: a new image will delete the previous ones with same rel
rel: String,
name: String,
contentType: Option[String],
size: Int, // in bytes
createdAt: DateTime
) {
@ -57,8 +56,7 @@ final class PicfitApi(coll: Coll, ws: StandaloneWSClient, config: PicfitConfig)(
_id = PicfitImage.Id(s"${lila.common.ThreadLocalRandom nextString 10}.$extension"),
user = userId,
rel = rel,
name = sanitizeName(uploaded.filename),
contentType = uploaded.contentType,
name = uploaded.filename,
size = uploaded.fileSize.toInt,
createdAt = DateTime.now
)
@ -74,11 +72,6 @@ final class PicfitApi(coll: Coll, ws: StandaloneWSClient, config: PicfitConfig)(
.flatMap { _.result[PicfitImage] ?? picfitServer.delete }
.void
private def sanitizeName(name: String) = {
// the char `^` breaks play, even URL encoded
java.net.URLEncoder.encode(name, "UTF-8").replaceIf('%', "")
}
private object picfitServer {
def store(image: PicfitImage, from: Uploaded): Funit = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -34,6 +34,7 @@
background-image: img-url('placeholder-margin.png');
background-size: cover;
background-position: center;
height: 200px;
}
}