Search Posts

Category: image

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