diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af0cd93..de3c8c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ image: hatsoftwares/lutim-test-ci:latest stages: + - publish_changelog - podcheck - carton - carton_bdd @@ -15,25 +16,29 @@ variables: ### Jobs templates ## # -.carton_bdd_template: &carton_bdd_definition - stage: carton_bdd +.retry: &retry retry: 2 + except: + - tags +.carton_bdd_template: &carton_bdd_definition + <<: *retry + stage: carton_bdd 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 ## diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 057b52d..0000000 --- a/.tx/config +++ /dev/null @@ -1,8 +0,0 @@ -[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/.po diff --git a/CHANGELOG b/CHANGELOG index 330167b..6a43b29 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ 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 diff --git a/lib/Lutim/Controller/Image.pm b/lib/Lutim/Controller/Image.pm index 5658513..e3bbc62 100644 --- a/lib/Lutim/Controller/Image.pm +++ b/lib/Lutim/Controller/Image.pm @@ -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(); + $im->BlobToImage($upload->slurp); - # Update the uploaded file with it's auto-rotated clone - my $asset = Mojo::Asset::Memory->new->add_chunk($im->ImageToBlob()); - $upload->asset($asset); + # Automatic rotation from EXIF tag + $im->AutoOrient(); - # Create the thumbnail - $width = $im->Get('width'); - $height = $im->Get('height'); - $im->Resize(geometry=>'x85'); + # Update the uploaded file with it's auto-rotated clone + my $asset = Mojo::Asset::Memory->new->add_chunk($im->ImageToBlob()); + $upload->asset($asset); - $thumb = 'data:'.$mediatype.';base64,'; - if ($mediatype eq 'image/gif') { - $thumb .= b64_encode $im->[0]->ImageToBlob(); - } else { - $thumb .= b64_encode $im->ImageToBlob(); - } + # 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(); } } diff --git a/themes/default/templates/partial/gallery.js.ep b/themes/default/templates/partial/gallery.js.ep index cc9bc5d..d39b2b9 100644 --- a/themes/default/templates/partial/gallery.js.ep +++ b/themes/default/templates/partial/gallery.js.ep @@ -214,6 +214,26 @@ function addAlert(e) { ].join('')); } +function appendToGallery(url, width, height) { + $('.gallery').append( + [ + '
', + ' ', + ' ', + ' ', + '
' + ].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( - [ - '
', - ' ', - ' ', - ' ', - '
' - ].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.