Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add width an height attribute to image #387

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions view/frontend/layout/blog_default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<action method="setBlockTitle">
<argument name="time" xsi:type="string">Recent Posts</argument>
</action>
<arguments>
<argument name="width" xsi:type="number">60</argument>
<argument name="height" xsi:type="number">40</argument>
</arguments>
</block>
<block class="Magefan\Blog\Block\Sidebar\Featured" name="blog.sidebar.featured" template="sidebar/recent.phtml">
<action method="setCacheLifetime">
Expand All @@ -33,6 +37,10 @@
<action method="setBlockTitle">
<argument name="time" xsi:type="string">Featured Posts</argument>
</action>
<arguments>
<argument name="width" xsi:type="number">60</argument>
<argument name="height" xsi:type="number">40</argument>
</arguments>
</block>
<block class="Magefan\Blog\Block\Sidebar\Popular" name="blog.sidebar.popular" template="sidebar/recent.phtml">
<action method="setCacheLifetime">
Expand All @@ -41,6 +49,10 @@
<action method="setBlockTitle">
<argument name="time" xsi:type="string">Popular Posts</argument>
</action>
<arguments>
<argument name="width" xsi:type="number">300</argument>
<argument name="height" xsi:type="number">200</argument>
</arguments>
</block>
<block class="Magefan\Blog\Block\Sidebar\Archive" name="blog.sidebar.archive" template="sidebar/archive.phtml">
<action method="setCacheLifetime">
Expand All @@ -55,6 +67,10 @@
<block class="Magefan\Blog\Block\Sidebar\Custom" name="blog.sidebar.custom" template="sidebar/custom.phtml" />
<block class="Magefan\Blog\Block\Sidebar\CustomTwo" name="blog.sidebar.custom2" template="sidebar/custom.phtml" />
<block class="Magefan\Blog\Block\Sidebar\Rss" name="blog.sidebar.rss" template="sidebar/rss.phtml">
<arguments>
<argument name="width" xsi:type="number">20</argument>
<argument name="height" xsi:type="number">20</argument>
</arguments>
<action method="setCacheLifetime">
<argument name="time" xsi:type="string">86400</argument>
</action>
Expand Down
4 changes: 4 additions & 0 deletions view/frontend/layout/blog_post_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<argument name="style_view_model" xsi:type="object">Magefan\Blog\ViewModel\Style</argument>
</arguments>
<block class="Magefan\Blog\Block\Post\PostList\Item" name="blog.posts.list.item" template="post/list/item.phtml">
<arguments>
<argument name="width" xsi:type="string">800</argument>
<argument name="height" xsi:type="string">500</argument>
</arguments>
<block class="Magefan\Blog\Block\Post\Info" name="blog.post.info" template="post/info.phtml" />
<action method="setPostInfoBlockName">
<argument name="name" xsi:type="string">blog.post.info</argument>
Expand Down
11 changes: 10 additions & 1 deletion view/frontend/layout/blog_post_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@
<referenceContainer name="content">
<block class="Magefan\Blog\Block\Post\View\ViewsCount" name="blog.posts.views.count" template="post/view/views_count.phtml"></block>
<block class="Magefan\Blog\Block\Post\View" name="blog.post" template="post/view.phtml">
<arguments>
<argument name="width" xsi:type="number">800</argument>
<argument name="height" xsi:type="number">500</argument>
</arguments>
<block class="Magefan\Blog\Block\Post\Info" name="blog.post.info" template="post/info.phtml" />
<action method="setPostInfoBlockName">
<argument name="name" xsi:type="string">blog.post.info</argument>
</action>
<container name="blog.post.bottom" label="Blog Post Bottom Container" >
<block class="Magefan\Blog\Block\Post\View\Gallery" name="blog.post.gallery" as="gallery" template="Magefan_Blog::post/view/gallery.phtml" />
<block class="Magefan\Blog\Block\Post\View\Gallery" name="blog.post.gallery" as="gallery" template="Magefan_Blog::post/view/gallery.phtml" >
<arguments>
<argument name="width" xsi:type="number">300</argument>
<argument name="height" xsi:type="number">300</argument>
</arguments>
</block>
<block class="Magefan\Blog\Block\Post\View\NextPrev" name="blog.post.nextprev" as="nextprev" template="Magefan_Blog::post/view/nextprev.phtml" />
<block class="Magefan\Blog\Block\Post\View\RelatedPosts" name="blog.post.relatedposts" as="relatedposts" template="Magefan_Blog::post/view/relatedposts.phtml" />
<block class="Magefan\Blog\Block\Post\View\RelatedProducts" name="blog.post.relatedproducts" as="relatedproducts" template="Magefan_Blog::post/view/relatedproducts.phtml" />
Expand Down
9 changes: 7 additions & 2 deletions view/frontend/templates/post/list/item.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
$_post = $block->getPost();
$_postUrl = $block->escapeUrl($_post->getPostUrl());
$_postName = $block->escapeHtml($_post->getTitle());
$width = (int)$block->getWidth() ?: 800;
$height = (int)$block->getHeight() ?: 500;
?>
<li class="post-holder post-holder-<?= (int)$_post->getId() ?>">
<div class="post-header">
Expand Down Expand Up @@ -59,7 +61,10 @@ $_postName = $block->escapeHtml($_post->getTitle());
<a href="<?= /*@noEscape*/ $_postUrl ?>"
title="<?= /*@noEscape*/ $_postName ?>">
<img src="<?= $block->escapeUrl($featuredImage) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
alt="<?= $block->escapeHtml($featuredImgAlt) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
/>
</a>
</div>
<?php } ?>
Expand All @@ -76,4 +81,4 @@ $_postName = $block->escapeHtml($_post->getTitle());
<div class="post-footer">

</div>
</li>
</li>
11 changes: 9 additions & 2 deletions view/frontend/templates/post/list/toolbar/lazyload.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
* @var $block \Magefan\Blog\Block\Post\PostList\Toolbar\Pager
*/
?>
<?php
$width = 220;
$height = 150;
?>
<?php if ($block->useLazyload()) { ?>
<?php
$config = $block->getLazyloadConfig([
Expand All @@ -28,6 +32,9 @@
</button>
<img class="posts-loader mfblog-show-onload"
src="<?= $block->escapeUrl($block->getViewFileUrl('images/loader-2.gif')) ?>"
alt="<?= $block->escapeHtml(__('Posts loader')) ?>" />
alt="<?= $block->escapeHtml(__('Posts loader')) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
/>
</div>
<?php } ?>
<?php } ?>
7 changes: 6 additions & 1 deletion view/frontend/templates/post/view-modern.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
$_post = $block->getPost();
$_postUrl = $_post->getPostUrl();
$_postName = $block->escapeHtml($_post->getTitle(), null);
$width = (int)$block->getWidth() ?: 800;
$height = (int)$block->getHeight() ?: 500;
?>
<?= $block->getStyleViewModel()->getStyle('Magefan_Blog::css/bootstrap-4.4.1-custom-min.css') ?>
<div class="_post-view">
Expand Down Expand Up @@ -99,7 +101,10 @@
?>
<div class="post-featured-image">
<img src="<?= $block->escapeUrl($featuredImage) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
alt="<?= $block->escapeHtml($featuredImgAlt) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
/>
</div>
<?php } ?>

Expand Down
9 changes: 7 additions & 2 deletions view/frontend/templates/post/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
$_post = $block->getPost();
$_postUrl = $_post->getPostUrl();
$_postName = $block->escapeHtml($_post->getTitle(), null);
$width = (int)$block->getWidth() ?: 800;
$height = (int)$block->getHeight() ?: 500;
?>
<div class="post-view">
<div class="post-holder post-holder-<?= (int)$_post->getId() ?>">
Expand All @@ -41,7 +43,10 @@ $_postName = $block->escapeHtml($_post->getTitle(), null);
?>
<div class="post-ftimg-hld">
<img src="<?= $block->escapeUrl($featuredImage) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
alt="<?= $block->escapeHtml($featuredImgAlt) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
/>
</div>
<?php } ?>
<div class="post-text-hld">
Expand All @@ -55,4 +60,4 @@ $_postName = $block->escapeHtml($_post->getTitle(), null);
<?= $block->getChildHtml('blog.post.bottom') ?>
</div>
</div>
</div>
</div>
8 changes: 7 additions & 1 deletion view/frontend/templates/post/view/comments/magefan.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
$session = $block->getCustomerSession();

$canPost = $block->canPost();
$width = 200;
$height = 200;
?>
<div id="post-comments">
<div class="c-count">
Expand All @@ -28,7 +30,11 @@
<div class="c-reply cf">
<?php if ($image = $block->getCustomerImage()) { ?>
<div class="c-img">
<img src="<?= $block->escapeUrl($image) ?>" alt="<?= $block->escapeHtml($block->getCustomerName()) ?>">
<img src="<?= $block->escapeUrl($image) ?>"
alt="<?= $block->escapeHtml($block->getCustomerName()) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
>
</div>
<?php } ?>
<div class="c-replyform <?php if ($canPost) { echo 'no-active'; } ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
<?php
$comment = $block->getComment();
$numberOfCommentsToDisplay = $block->getNumberOfReplies();
$width = 200;
$height = 200;
?>
<div class="c-comment c-comment-parent-<?= (int)$comment->getParentId() ?>"
<?php if ($comment->getIsHidden()) { echo 'style="display:none"'; } ?>>
<?php if ($authorImage = $comment->getAuthorImage()) { ?>
<div class="c-img">
<img src="<?= $block->escapeUrl($authorImage) ?>" alt="<?= $block->escapeHtml($comment->getAuthorName()) ?>">
<img src="<?= $block->escapeUrl($authorImage) ?>"
alt="<?= $block->escapeHtml($comment->getAuthorName()) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
>
</div>
<?php } ?>
<div class="c-post c-post-<?= (int)$comment->getId() ?>" id="c-post-<?= (int)$comment->getId() ?>">
Expand Down
9 changes: 8 additions & 1 deletion view/frontend/templates/post/view/gallery.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
$post = $block->getPost();
$galleryImages = $post->getGalleryImages();
$viewFileUrl = $block->getViewFileUrl("Magefan_Blog::css/jquery.fancybox.min.css");
$width = (int)$block->getWidth() ?: 300;
$height = (int)$block->getHeight() ?: 300;
?>

<?php if (count($galleryImages)) { ?>
Expand All @@ -27,7 +29,12 @@
data-fancybox="gallery"
href="<?= $block->escapeUrl($image) ?>"
rel="nofollow">
<img class="gallery-image" src="<?= $block->escapeUrl($image->resize(200)) ?>" alt="" />
<img class="gallery-image"
src="<?= $block->escapeUrl($image->resize(200)) ?>"
alt=""
width="<?= $width ?>"
height="<?= $height ?>"
/>
</a>
<?php } ?>
</div>
Expand Down
11 changes: 7 additions & 4 deletions view/frontend/templates/sidebar/recent.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
$_postCollection = $block->getPostCollection();
?>
<?php
$width = (int)$block->getBlockImageWidth() ?: 300;
$height = (int)$block->getBlockImageheight() ?: 200;
$width = (int)$block->getWidth() ?: 300;
$height = (int)$block->getHeight() ?: 200;
$imageHelper = $this->helper(\Magefan\Blog\Helper\Image::class);
?>
<?php if ($_postCollection->count()) { ?>
Expand Down Expand Up @@ -51,8 +51,11 @@
$featuredImageUrl = $this->getViewFileUrl('Magefan_Blog::images/default-no-image.png');
}
?>
<img data-width-amp="<?= $width ?>" data-height-amp="<?= $height ?>" layout="responsive" src="<?= $block->escapeUrl($featuredImageUrl) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
<img src="<?= $block->escapeUrl($featuredImageUrl) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
/>
</a>
</div>
<?php } ?>
Expand Down
9 changes: 7 additions & 2 deletions view/frontend/templates/sidebar/rss.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
* @var $block \Magefan\Blog\Block\Sidebar\Rss
*/
?>
<?php
$width = (int)$block->getWidth() ?: 17;
$height = (int)$block->getHeight() ?: 17;
?>
<div class="widget block block-rss" data-bind="scope: 'blog-rss'">
<div class="block-title">
<strong>
Expand All @@ -21,8 +25,9 @@
<?= $block->escapeHtml(__('RSS Feed')) ?>
</a>
</strong>
<img width="17" height="17" class="rss-icon"
<img width="<?= $width ?>" height="<?= $height ?>" class="rss-icon"
src="<?= $block->escapeUrl($block->getViewFileUrl('Magefan_Blog::images/rss-icon.png')) ?>"
alt="<?= $block->escapeHtml(__('RSS Feed')) ?>" >
alt="<?= $block->escapeHtml(__('RSS Feed')) ?>"
>
</div>
</div>
9 changes: 7 additions & 2 deletions view/frontend/templates/widget/recent.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

<?php
$_postCollection = $block->getPostCollection();
$width = (int)$block->getWidth() ?: 500;
$height = (int)$block->getHeight() ?: 400;
?>
<?php if ($_postCollection->count()) { ?>
<div class="post-list-wrapper blog-widget-recent">
Expand Down Expand Up @@ -74,7 +76,10 @@
<div class="post-ftimg-hld">
<a href="<?= /*@noEscape*/ $_postUrl ?>" title="<?= /*@noEscape*/ $_postName ?>">
<img src="<?= $block->escapeHtml($featuredImage) ?>"
alt="<?= $block->escapeHtml($featuredImgAlt) ?>" />
alt="<?= $block->escapeHtml($featuredImgAlt) ?>"
width="<?= $width ?>"
height="<?= $height ?>"
/>
</a>
</div>
<?php } ?>
Expand All @@ -97,4 +102,4 @@
<?php } ?>
</ul>
</div>
<?php } ?>
<?php } ?>