We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Automatically Embed Image Attachments in Posts
Topic Started: Aug 23 2016, 07:38 PM (496 Views)
DaPizzaMan
Member Avatar
#TeamSupport

Code Name: Automatically Embed Image Attachments in Posts

What the code does: Any images ending with gif, png, jpg, or jpeg (more file types can be added!) will be added directly to your post once you upload them as attachments. See this topic to view the code in action.

How to use the code: Modify the attachmentImagesToPostImagesTypes as you see fit if you want any other image file types to automatically be added to posts. Other than that, just install the code as instructed below.

How to install the code: Add the below code to Admin CP -> Board Template -> Above the Copyright

Extra notes: Posts made prior to adding this code will not be affected by this code. This code was made a while back in response to this request - I just never got around to posting this topic.

Code:
 
<script type="text/javascript">
if (location.href.indexOf(main_url + 'topic/') !== -1 && $.zb.get('auto-embed-files')) {
var attachmentImagesToPostImagesTypes = ['gif', 'png', 'jpg', 'jpeg']; // ONLY EDIT THIS LINE
$.ajax({url:'http://z4.ifrm.com/30296/128/0/p1170587/EmbedAttachmentImages.js', dataType:'script', cache:true});
}

$('table.posting #c_postbtn button[name="post_submit"].btn_default').click(function() {
var numFiles = 0;
$('#files_upload input[type="file"]').each(function() {
numFiles += this.files.length; // somehow this gives me the number of files set for upload...
});
if (numFiles > 0) {
$.zb.set('auto-embed-files', numFiles);
}
});
</script>
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply