Search Posts

Category: image

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)) . […]