reduces image weight for gallery
This commit is contained in:
parent
a79171fef5
commit
546fde4d7a
|
@ -90,8 +90,12 @@ class SmartGallery extends AbstractBlockLayout
|
|||
{
|
||||
$mediaType = $media->mediaType();
|
||||
$mediaRenderer = $media->renderer();
|
||||
if ((strpos($mediaType, 'image/') !== false) || (strpos($mediaRenderer, 'youtube') !== false)) {
|
||||
array_push($images, ["media_url" => $media->originalUrl(),
|
||||
if (strpos($mediaType, 'image/') !== false) {
|
||||
$new_url = $media->originalUrl();
|
||||
// original files size may be very large. /large/<name>.jpg is smaller
|
||||
$new_url = substr_replace($new_url, 'jpg', strrpos($new_url, '.') +1);
|
||||
$new_url = str_replace("original", "large", $new_url);
|
||||
array_push($images, ["media_url" => $new_url,
|
||||
"item_url" => $attachment->item()->url(),
|
||||
"image_title" => $media->title(),
|
||||
"img_id" => 'gi_' . $gallery_id . '_' . $img_id,
|
||||
|
|
|
@ -6,6 +6,12 @@ $this->headLink()->appendStylesheet($this->assetUrl('css/style.css',
|
|||
|
||||
?>
|
||||
|
||||
<!--
|
||||
<script>
|
||||
console.log(<?= json_encode($images, JSON_UNESCAPED_SLASHES) ?>)
|
||||
</script>
|
||||
-->
|
||||
|
||||
<?php $image_id = 0; ?>
|
||||
|
||||
<div class="archive-item-block smart-gallery">
|
||||
|
|
Loading…
Reference in New Issue