i don't know why you didn't incorporate my edit
https://community.mybb.com/thread-170611...pid1308723
if you don't images that are embeded in 1 post will only open one by one instead of grouping into a gallery
also if you have attachement to show full image instead of thumbnail then fancybox will not work
and change
find_replace_templatesets("headerinclude", "#" . preg_quote('{$stylesheets}<link rel="stylesheet" href="/jscripts/fancybox/jquery.fancybox.min.css" type="text/css" media="screen" /><script type="text/javascript" src="/jscripts/fancybox/jquery.fancybox.min.js"></script><script type="text/javascript" src="/jscripts/mybbfancybox.js"></script>') . "#i",'{$stylesheets}');
}
to
find_replace_templatesets("headerinclude", "#" . preg_quote('{$stylesheets}<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/fancybox/jquery.fancybox.min.css" type="text/css" media="screen" /><script type="text/javascript" src="{$mybb->asset_url}/jscripts/fancybox/jquery.fancybox.min.js"></script><script type="text/javascript" src="{$mybb->asset_url}/jscripts/mybbfancybox.js"></script>') . "#i",'{$stylesheets}');
}
i had 404 not found on those
here is my test thread of current rls:
https://www.blackmarke7.org/mybbtest/sho....php?tid=3
had to change the headerinclude template with the change i suggsted above to get fancybox to load
also i found some better lightbox alternative
https://fengyuanchen.github.io/viewer/ <-- best but i have trouble getting it to work / work properly
http://sachinchoolur.github.io/lightGallery/ <-- 2nd best which i'm currently using on my site since i can't get the above to work
in conclusion
if some1 can get
https://fengyuanchen.github.io/viewer/ to work then that will be the best
problems that i had:
1. getting it working
2. even when i had it working, which i had no clue why i couldn't get it working again, it'll group all images into the gallery including smilies
3. can't get it working with attachment
I wont add your changes because they break functionality. About others viewers - there are plenty of them for free, I have tested a lot of them but FancyBox seems to be the best of them when you compare all aspects. Please create a new thread for discussion about other alternatives.
P.S. your link is not working for non regustered users, send me a test account via PM to test it. About 404 error, it was fixed already, new version will contain that fix.
(2018-08-07, 05:15 AM)Eldenroot Wrote: [ -> ]I wont add your changes because they break functionality. About others viewers - there are plenty of them for free, I have tested a lot of them but FancyBox seems to be the best of them when you compare all aspects. Please create a new thread for discussion about other alternatives.
P.S. your link is not working for non regustered users, send me a test account via PM to test it. About 404 error, it was fixed already, new version will contain that fix.
what do you mean by break functionality?
do you mean this part?
.scaleimages img {
max-width: 60%;
height: auto;
}
or the following?
Quote:after doing the following you'll be able to open all images in 1 post with fancybox gallery
change the headerinclude lines in first post to
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/jquery.fancybox.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.post_body img').each(function() {
var currentImage = $(this);
var pid = currentImage.parents('.post_body.scaleimages').attr('id');
if (currentImage.hasClass('smilie') == false && currentImage.parent().is('a') == false) {
currentImage.wrap("<a target='_blank' data-fancybox='" + pid + "' data-type='image' href='" + currentImage.attr("src") + "'</a>");
}
});
});
</script>
after doing the following you'll be able to open attached images with fancybox gallery even when you set
Show Attached Thumbnails in Posts to Full Size Image
change postbit_attachments_images_image template to
<img<a target='_blank' data-fancybox="data-{$attachment['pid']}" data-type='image' href="attachment.php?aid={$attachment['aid']}"><img src="attachment.php?aid={$attachment['aid']}" class="attachment" alt="" title="{$lang->postbit_attachment_filename} {$attachment['filename']}
{$lang->postbit_attachment_size} {$attachment['filesize']}
{$attachdate}" /> {$attachment['filename']}
{$lang->postbit_attachment_size} {$attachment['filesize']}
{$attachdate}" /></a>
i changed the permission to let guest view attachment
You have a lot of typos in code - postbit_attachments_images_image - please review

ok i removed the <img in the front
<a target='_blank' data-fancybox="data-{$attachment['pid']}" data-type='image' href="attachment.php?aid={$attachment['aid']}"><img src="attachment.php?aid={$attachment['aid']}" class="attachment" alt="" title="{$lang->postbit_attachment_filename} {$attachment['filename']}
{$lang->postbit_attachment_size} {$attachment['filesize']}
{$attachdate}" /> {$attachment['filename']}
{$lang->postbit_attachment_size} {$attachment['filesize']}
{$attachdate}" /></a>
@8guawong Better to do code suggestions on GitHub

I will review your code and maybe add it into next version. If anybody has any suggestion or a question let me know.
Anyway your code affects only images added into post via attachment, NOT all images added via img button in editor.
(2018-08-07, 10:18 AM)Wildcard Wrote: [ -> ]@8guawong Better to do code suggestions on GitHub 
i don't really know how to use github
(2018-08-07, 11:50 AM)Eldenroot Wrote: [ -> ]I will review your code and maybe add it into next version. If anybody has any suggestion or a question let me know.
Anyway your code affects only images added into post via attachment, NOT all images added via img button in editor.
Quote:after doing the following you'll be able to open all images in 1 post with fancybox gallery
change the headerinclude lines in first post to
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/jquery.fancybox.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.post_body img').each(function() {
var currentImage = $(this);
var pid = currentImage.parents('.post_body.scaleimages').attr('id');
if (currentImage.hasClass('smilie') == false && currentImage.parent().is('a') == false) {
currentImage.wrap("<a target='_blank' data-fancybox='" + pid + "' data-type='image' href='" + currentImage.attr("src") + "'</a>");
}
});
});
</script>
so in mybbfancybox.js change
$(document).ready(function() {
$('.post_body img').each(function() {
var currentImage = $(this);
if (currentImage.hasClass('smilie') == false && currentImage.parent().is('a') == false) {
currentImage.wrap("<a title='Click to enlarge' target='_blank' data-fancybox data-type='image' href='" + currentImage.attr("src") + "'>");
}
});
to
$(document).ready(function() {
$('.post_body img').each(function() {
var currentImage = $(this);
var pid = currentImage.parents('.post_body.scaleimages').attr('id');
if (currentImage.hasClass('smilie') == false && currentImage.parent().is('a') == false) {
currentImage.wrap("<a title='Click to enlarge' target='_blank' data-fancybox='" + pid + "' data-type='image' href='" + currentImage.attr("src") + "'>");
}
});
});