Verified Commit 55dec02d authored by Luc Didry's avatar Luc Didry
Browse files

Merge branch 'development'

parents ffcb48ba 78da8511
image: hatsoftwares/lutim-test-ci:latest
stages:
- publish_changelog
- podcheck
- carton
- carton_bdd
......@@ -15,25 +16,29 @@ variables:
### Jobs templates
##
#
.retry: &retry
retry: 2
except:
- tags
.carton_bdd_template: &carton_bdd_definition
<<: *retry
stage: carton_bdd
retry: 2
artifacts:
paths:
- local/
dependencies:
- carton
.sqlite_template: &sqlite_definition
<<: *retry
stage: tests
retry: 2
artifacts:
paths:
- cover_db/
dependencies:
- carton_sqlite
.pg_template: &pg_definition
<<: *retry
stage: tests
retry: 2
artifacts:
paths:
- cover_db/
......@@ -43,10 +48,26 @@ variables:
- name: postgres:9.6
alias: postgres
### Publish tag changelog
##
#
publish_changelog:
image: hatsoftwares/curl-jq:latest
stage: publish_changelog
script:
- export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
- export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}/release"
- 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
- sed -n '/^'$CI_COMMIT_TAG'[[:space:]]/,/^[^\t]/p' CHANGELOG | sed -e 's/^[^\t].*//' -e 's/\t//g' | sed '/^[[:space:]]*$/d' > /tmp/text
- if [[ ! -z $GITLAB_API_TOKEN ]]; then curl -s --request POST --data-urlencode "description@/tmp/text" --header "${HEADER}" "${DESCRIPTION_URL}"; fi
only:
- tags
### Podcheck
##
#
podcheck:
<<: *retry
stage: podcheck
script:
- make podcheck
......@@ -55,6 +76,7 @@ podcheck:
##
#
carton:
<<: *retry
stage: carton
artifacts:
paths:
......@@ -63,7 +85,6 @@ carton:
script:
- carton install --deployment --without=sqlite --without=postgresql --without=minion --without=cache --without=memcached
when: always
retry: 2
### Install DB related dependencies
##
......
[main]
host = https://www.transifex.com
[lutim.enpo]
source_file = lib/Lutim/I18N/en.po
source_lang = en
type = PO
file_filter = lib/Lutim/I18N/<lang>.po
Revision history for Lutim
0.11.5 2019-04-xx
- Revert catching Image::Magick problems
- In gallery, use JS to find image's width and height if not provided by image's infos
0.11.4 2018-11-18
- Catch Image::Magick problems
- Update arabic translation
......
......@@ -401,25 +401,25 @@ sub add {
my ($width, $height);
if ($im_loaded && $mediatype ne 'image/svg+xml' && $mediatype !~ m#image/(x-)?xcf# && $mediatype ne 'image/webp') { # ImageMagick don't work in Debian with svg (for now?)
my $im = Image::Magick->new;
if($im->BlobToImage($upload->slurp)) {
# Automatic rotation from EXIF tag
$im->AutoOrient();
# Update the uploaded file with it's auto-rotated clone
my $asset = Mojo::Asset::Memory->new->add_chunk($im->ImageToBlob());
$upload->asset($asset);
# Create the thumbnail
$width = $im->Get('width');
$height = $im->Get('height');
$im->Resize(geometry=>'x85');
$thumb = 'data:'.$mediatype.';base64,';
if ($mediatype eq 'image/gif') {
$thumb .= b64_encode $im->[0]->ImageToBlob();
} else {
$thumb .= b64_encode $im->ImageToBlob();
}
$im->BlobToImage($upload->slurp);
# Automatic rotation from EXIF tag
$im->AutoOrient();
# Update the uploaded file with it's auto-rotated clone
my $asset = Mojo::Asset::Memory->new->add_chunk($im->ImageToBlob());
$upload->asset($asset);
# Create the thumbnail
$width = $im->Get('width');
$height = $im->Get('height');
$im->Resize(geometry=>'x85');
$thumb = 'data:'.$mediatype.';base64,';
if ($mediatype eq 'image/gif') {
$thumb .= b64_encode $im->[0]->ImageToBlob();
} else {
$thumb .= b64_encode $im->ImageToBlob();
}
}
......
......@@ -214,6 +214,26 @@ function addAlert(e) {
].join(''));
}
function appendToGallery(url, width, height) {
$('.gallery').append(
[
'<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">',
' <a href="', url, '" itemprop="contentUrl" data-size="', width, 'x', height, '">',
' <img src="', url, '?width=275" itemprop="thumbnail" alt="" class="img-responsive"/>',
' </a>',
'</figure>'
].join('')
);
}
function nextOrInitGallery(keys) {
if (keys.length > 0) {
addElement(keys);
} else {
initPhotoSwipeFromDOM('.gallery');
}
}
function addElement(keys) {
element = keys.shift();
if (!element.match('xcf')) {
......@@ -223,29 +243,29 @@ function addElement(keys) {
dataType: 'json',
success: function(data, textStatus, jqXHR) {
if (data.success) {
$('.gallery').append(
[
'<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">',
' <a href="', absUrl+element, '" itemprop="contentUrl" data-size="', data.data.width, 'x', data.data.height, '">',
' <img src="', absUrl+element, '?width=275" itemprop="thumbnail" alt="" class="img-responsive"/>',
' </a>',
'</figure>'
].join('')
);
if (data.data.width && data.data.height) {
appendToGallery(absUrl+element, data.data.width, data.data.height);
nextOrInitGallery(keys);
} else {
var img = new Image();
img.onload = function(){
appendToGallery(absUrl+element, img.width, img.height);
nextOrInitGallery(keys);
}
img.src = absUrl+element;
}
} else {
addAlert(data.msg);
nextOrInitGallery(keys);
}
},
complete: function() {
if (keys.length > 0) {
addElement(keys);
} else {
initPhotoSwipeFromDOM('.gallery');
}
error: function(jqXHR, textStatus, errorThrown) {
nextOrInitGallery(keys);
}
});
}
}
$(document).ready(function() {
var key = window.location.hash.substring(1); // Get key
// First, strip everything after the equal sign (=) which signals end of base64 string.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment