2019-09-29, 12:05 AM
Does the latest version of MyBB support copy/pasting images into a post? I was referring to a Gmail type editor that allows external images to be pasted in-line in the mail, NOT as an attachment.
Thanks
Thanks
(2019-09-29, 06:23 PM)effone Wrote: [ -> ]And no, it doesn't save the image as separate file.
[img]
code, as the image data is stored into the database (in post content) but using a mycode to show.[IMG]
are not same.(2019-09-30, 10:15 AM)effone Wrote: [ -> ]Privilege of uploading attachments and usage of[IMG]
are not same.
I do agree and thought about the column length but this is just the basic support provided at the end of 1.8 era and doesn't really affect unless the post content is too long. Expected we are gonna use a better and efficient parser in future.
[img]
code. Users post such images in forums that forbid uploading but allow using [img]
code may leverage this trick to bypass the permissions/limitations on uploading attachment.[img]
code is the best way to show it. If the image is added by a data URI, just like OP said what OP wants, probably most forum owners want, is treat the image as an attachment like how Gmail does.(2019-09-30, 10:15 AM)effone Wrote: [ -> ]If any additional setting or permission is required to be imposed to handle any raised issue for this implementation then that will be discussed and handled separately. The PR is about providing support of data URI to parser, saving the image converting to additional file is just opposing the effort by definition.
message
.(2019-09-30, 11:31 AM)effone Wrote: [ -> ]We can have a different valid view as the topic itself is odd.
What I thought is we should not manipulate or tamper user input data, if the user is providing a data URI knowing or unknowingly we should carry the same.
We can have further discussion for this, if required; here or in discord as the concerns you've stated are valid too. If a different approach is required that can also be adapted. Thanks for your concerns @noyle
I'll mark this to Euan for his value addition as well.
(2019-09-29, 12:05 AM)jtapp Wrote: [ -> ](...)
I was referring to a Gmail type editor that allows external images to be pasted in-line in the mail, NOT as an attachment.
(...)
[img]https://[/img]
like text into post content.Quote: https://github.com/discourse/discourse/b...s.es6#L276
if (contentEditableDiv.html().length > 0) { // If the image wasn't the only pasted content we just give up and // fall back to the original pasted text. contentEditableDiv.find("br").replaceWith("\n"); restoreSelection(contentEditableDiv.text()); } else { // Depending on how the image is pasted in, we may get either a // normal URL or a data URI. If we get a data URI we can convert it // to a Blob and upload that, but if it is a regular URL that // operation is prevented for security purposes. When we get a regular // URL let's just create an <img> tag for the image. const imageSrc = pastedImg.attr('src'); if (imageSrc.match(/^data:image/)) { // Restore the cursor position, and remove any selected text. restoreSelection(""); // Create a Blob to upload. const image = new Image(); image.onload = () => { // Create a new canvas. const canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); canvas.height = image.height; canvas.width = image.width; const ctx = canvas.getContext('2d'); ctx.drawImage(image, 0, 0); canvas.toBlob(blob => this.$().fileupload('add', {files: blob})); }; image.src = imageSrc; } else { restoreSelection("<img src='" + imageSrc + "'>"); }