steveathon / bootstrap-wysiwyg

Tiny bootstrap-compatible WYSIWYG rich text editor
MIT License
661 stars 1.71k forks source link

is there any way to resize image ? #124

Open summit2020 opened 7 years ago

codewithtyler commented 7 years ago

Please see issues #35 and #88.

summit2020 commented 7 years ago

Thanks.. cracked it ..

icandothat2 commented 6 years ago

I solved it this way.

 $.when(readFileIntoDataUrl(fileInfo)).done(function (dataUrl) {
     var randomID = "I_"+ Math.floor(Math.random() * 20);
     var imgHTMLstr ='<img id="'+randomID+'" src="'+dataUrl+'"></img>';
          // replaced the original code with insertHTML so we could get an ID on this image
     execCommand('insertHTML', imgHTMLstr);
        //now that we have the ID we can invoke  jquery  resizeable api
              $(function () {
                    $("#"+randomID).resizable();
         });
    //just replace the code below with the code above.
      //execCommand('insertimage', dataUrl);//original code
spreadred commented 6 years ago

@icandothat2 Elegant. Does this actually resize the image though, or simply modify the way it is displayed? IE: If I am sending the editor content to a server via POST for storage, the image will be stored as its original size, correct?

icandothat2 commented 6 years ago

Thank you, You are Correct. It does not "resize" the image in the sense that the image data is not changed, it just looks smaller on screen. To actually resize the image would take a canvas element. I actually may still put it into a canvas to enable on screen drawing etc. but for now resizing was a good first step.

On Wed, May 30, 2018 at 2:45 PM, kaptainkommie notifications@github.com wrote:

@icandothat2 https://github.com/icandothat2 Elegant. Does this actually resize the image though, or simply modify the way it is displayed? IE: If I am sending the editor content to a server via POST for storage, the image will be stored as its original size, correct?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/steveathon/bootstrap-wysiwyg/issues/124#issuecomment-393329928, or mute the thread https://github.com/notifications/unsubscribe-auth/APcqjCrqS53aDtfE6a93EJiXDkBiIhBLks5t3xLngaJpZM4NUNnZ .

spreadred commented 6 years ago

Thanks, I had implemented resizing using canvas for my use case, but I was curious if this worked similarly.