Search Posts

Category: image

How to strip off formatting in Quill image editor

Currently quill editor will save the image in base64 image. That is fine for now. But how do I make sure quill save the base64 content only and without those formatting? This is how it would like after the image has been saved in the db. <p><img src=”data:image/png;base64,iVBXXXXXXXXXXXXXXXXXXXXXXXXXXX”></p> Basically I want to strip off “< p >” and < img src= tags. I would like to retain data:image/png;base64,iVBXXXXXXXXXX only. Is there any setting that I […]

AngularJs – Getting value of ng-src attribute in controller function

I am working on browse and upload image functionality in my AngularJs application. I am using ng-image-compress for compressing image. I need to access a value of ng-src attribute in my controller whenever user selects an image from browse file dialog. <input id=”File1″ type=”file” accept=”image/*” image=”image1″ ng-image-compress ng-model=”image2″ resize-max-height=”800″ resize-max-width=”800″ resize-quality=”0.7″ resize-type=”image/jpg” onchange=”angular.element(this).scope().uploadPhoto()” /> <br /><br /> <img ng-src=”{{image1.compressed.dataURL}}” class=”thumb” /> using above code, when I selects image, uploadPhoto() method called and selected image displays […]

Rotate image with center point in javascript

Here is my javascript code sliderCtrlPtr.GetsliderStyle = function () { if(sliderCtrlPtr.sliderParams != undefined) { var styleObj = sliderCtrlPtr.sliderParams; var canvas = document.getElementById(“canvas”); var ctx = canvas.getContext(“2d”); var backgroundHeight = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“height”]; var backgroundWidth = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“width”]; var backgroundTop = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“top”]; var backgroundLeft = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“left”]; var startPointLeft = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PointPositioninData”][“startPointCanvasLeftInPercentage”]; var startPointTop = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PointPositioninData”][“startPointCanvasTopInPercentage”]; var pivotPointLeft = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PointPositioninData”][“pivotPointCanvasLeftPositionInPercentage”]; var pivotPointTop = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PointPositioninData”][“pivotPointCanvasTopInPercentage”]; var endPointLeft = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PointPositioninData”][“endPointCanvasLeftInPercentage”]; var endPointTop = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PointPositioninData”][“endPointCanvasTopInPercentage”]; var startVariableValue = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PlacementPointData”][“startPoint”]; var endVariableValue = styleObj[“styleMapping”][“2”][“StyleMappingCollection”][“636422818932601231”][“PlacementPointData”][“endPoint”]; var […]

Convert ByteArray into Image in AngularJs

I have written a controller in spring boot for getting image of particular user and i am returning it in form of byte array @GetMapping(value = “/images/{id}/{login}”,produces = {MediaType.APPLICATION_OCTET_STREAM_VALUE}) public byte[] getImage(@Valid @RequestParam(“id”) String id,@RequestParam(“login”) String login) throws IOException, XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, InvalidArgumentException, ErrorResponseException, NoResponseException, InvalidBucketNameException, InsufficientDataException, InternalException { return IOUtils.toByteArray(fileService.getImage(id, login)); } Is there a method in angularjs so that i could convert it in form of image So that i could display the […]

How to compress image size before uploading using php

I already searched lots of stuff, some of them are from stackoverflow. But none of them helped me. What I want to do is reduce the image file size, and after reducing the image will now be uploaded. Here’s my current code: <?php include ‘cloud_functions.php’; // GET THE USER’S ID $userid = _clean($con, $_POST[‘userid’]); if(!is_dir(“uploads/user/”.$userid.”/”)){ mkdir(“uploads/user/”.$userid.”/”, 0755); } $temp = explode(“.”, _clean($con,$_FILES[“file”][“name”])); $targetPath = “uploads/user/”.$userid.”/”; // RENAME THE IMAGE USING ROUND(); $newFN = round(microtime(true)) . […]