Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
matrix-stickers
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
matrix-stickers
Validations
219f6556
Valider
219f6556
rédigé
Il y a 2 ans
par
Elliu
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Fix conversion when not trusted
parent
7c4d7d26
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
stpkg
+26
-10
26 ajouts, 10 suppressions
stpkg
avec
26 ajouts
et
10 suppressions
stpkg
+
26
−
10
Voir le fichier @
219f6556
#!/bin/bash
#!/bin/bash
# TODO:
# Scale up, not only down
# Fail on remove empty sticker pack dir
# Test trusted source
shopt
-s
nocasematch
# Case insensitive
shopt
-s
nocasematch
# Case insensitive
STPKG_CONF_FILE
=
~/.config/stpkg.sh
STPKG_CONF_FILE
=
~/.config/stpkg.sh
...
@@ -632,29 +637,40 @@ process_sticker_file() {
...
@@ -632,29 +637,40 @@ process_sticker_file() {
# Convert animated image
# Convert animated image
#
#
local
DEST_TYPE
=
$STPKG_ANIMATED_TARGET_FILETYPE
local
DEST_TYPE
=
$STPKG_ANIMATED_TARGET_FILETYPE
local
BONUS_OPT
=
""
local
DEST_EXT
=
$(
file_get_ext_from_type
"
$DEST_TYPE
"
)
convert
"
${
FILE
}
"
-coalesce
-background
none
-trim
-layers
TrimBounds
"
$DEST_EXT
:
${
TEMP
}
"
1>&2
\
&&
progress_dot
\
||
die
"
$NAME
failed trimming the sticker"
convert
"
${
TEMP
}
"
-coalesce
-dispose
Background
-resize
${
DEST_WIDTH
}
x
${
DEST_HEIGHT
}
"
$DEST_EXT
:
${
TEMP
}
"
1>&2
\
&&
progress_dot
\
||
die
"
$NAME
failed resizing the sticker"
#convert "${TEMP}" -coalesce -layers OptimizePlus -layers RemoveDups -layers OptimizeTransparency "$DEST_EXT:${TEMP}" 1>&2 \
convert
"
${
TEMP
}
"
-coalesce
-layers
Optimize
"
$DEST_EXT
:
${
TEMP
}
"
1>&2
\
&&
progress_dot
\
||
die
"
$NAME
failed optimizing the sticker"
else
else
#
#
# Convert fixed image
# Convert fixed image
#
#
local
DEST_TYPE
=
$STPKG_IMAGE_TARGET_FILETYPE
local
DEST_TYPE
=
$STPKG_IMAGE_TARGET_FILETYPE
local
BONUS_OPT
=
"-trim +repage"
fi
local
DEST_EXT
=
$(
file_get_ext_from_type
"
$DEST_TYPE
"
)
local
DEST_EXT
=
$(
file_get_ext_from_type
"
$DEST_TYPE
"
)
convert
"
$FILE
"
-bordercolor
none
-border
1
${
BONUS_OPT
}
-background
none
-gravity
center
-resize
${
DEST_WIDTH
}
x
${
DEST_HEIGHT
}
"
${
DEST_EXT
}
:
${
TEMP
}
"
1>&2
\
convert
"
$FILE
"
-bordercolor
none
-border
1
-background
none
-gravity
center
-trim
+repage
-resize
${
DEST_WIDTH
}
x
${
DEST_HEIGHT
}
"
${
DEST_EXT
}
:
${
TEMP
}
"
1>&2
\
&&
progress_dot
\
&&
progress_dot
\
||
die
"
$NAME
failed converting the sticker"
||
die
"
$NAME
failed converting the sticker"
fi
DEST_WIDTH
=
$(
file_get_width
"
$TEMP
"
)
DEST_HEIGHT
=
$(
file_get_height
"
$TEMP
"
)
fi
fi
# TODO: get real width/height from generated file
# TODO: check for gifs here
DEST_WIDTH
=
$(
file_get_width
"
$TEMP
"
)
DEST_HEIGHT
=
$(
file_get_height
"
$TEMP
"
)
# Upload the transformed file
# Upload the transformed file
local
MXC
=
$(
__upload_file
"
$DEST_TYPE
"
"
$TEMP
"
"
$NAME
"
)
local
MXC
=
$(
__upload_file
"
$DEST_TYPE
"
"
$TEMP
"
"
$NAME
"
)
rm
"
$TEMP
"
progress_dot
progress_dot
JSON_REF
=
$(
create_sticker_json
"
$PACK_NAME
"
"
$NAME
"
"
$DEST_WIDTH
"
"
$DEST_HEIGHT
"
"
$DEST_TYPE
"
"
$MXC
"
)
JSON_REF
=
$(
create_sticker_json
"
$PACK_NAME
"
"
$NAME
"
"
$DEST_WIDTH
"
"
$DEST_HEIGHT
"
"
$DEST_TYPE
"
"
$MXC
"
)
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter