Displaying Image from Camera Roll Ionic - javascript

I am trying to load some images from the users camera roll using Ionic 1. I am using a component which allows me to pull the location of the images and compress them so they become thumbnails for displaying.
I have got the point where I can recover the image location however the issue I'm having is displaying it in an img view tag. The component outputs the file location in a format like:
'/var/mobile/Containers/Data/Application/BLAH-BLAH/tmp/B08CABBD-596C-4F1A-8905-C652C9DCBC4D^L0^001_mthumb.png'
I have tried many approaches like moving this image to anther location within the phone, renaming it to a shorter name appending the image with file:// or local:// tags and added the sanitation changes to the ionic.js. Using all of this the image back shrinks in size and doesn't show the image.
Any help would be greatly appreciated.

Related

DropzoneJS Preview Image fill the whole container

I am using a theme which uses Dropdown.js to upload files.
The JS file is over 1000 Lines and I feel a bit lost.
What I am trying to achieve is that I have a container where you drop a file. I want that when you choose an image the image will appear as a preview in the same container. Right now when I upload an image the preview is a small 100x100 picture. I want it to fill out the whole content and be able to upload 1 image only.
I am not able to achieve it as I am pretty new and the big js file is confusing me. If someone can point me in the right direction it would be great.
You are searching in the wrong file, your js controls the user experience. You need to work in the css of the dropzone, and add a width auto, height auto. Now to upload only one file that goes in you specifications of your dropzone, max-file: 1.
Check the documentation.
https://www.dropzonejs.com/

Js canvas manipulation with asset manager

I want to create a basic image js manipulation problem. Well not that basic. My requirements are
Image loaded after clicked by user
User can edit this image(contrast invert filter rotation)
User can use a dialog that displays some other smaller images. These images (fixed size) can be placed by clicking (or drag n dropped) on original first image
Images placed on original image can be rotated or moved.
I think fabric has what I want(rotating with anchors etc), but it doesn't include an asset manager? Is there a js library that has all these or is there a stand alone asset manager that can work well with fabricjs?

How to save transparent Clipart images(.png) over background image as a single image

I have overlapped some transparent .png images over .jpg background images using css, now I need to find a way to all images as single image(including all the overlapped images), so that I save it as a single image and have it for my use.
Detailed explanation : I'm working on a website where you could display some .png clip images over .jpg background image .To do that I have used some Div's each having images with single div for background image.and i have button for save image.. Now when the user clicks save button, I'm unable to save the overlapped images into a single image.
It would be of great help if someone could solve this issue.
For saveing all of resources like as css , js and images you use Google Chrome and after open developing tools (Press F12 and go to Resources tab and then frames folder) you can find all of images there and you can save it.

How can I scale/enlarge HTML content and save it as an image?

I have a JavaScript product designer that allows the web page user to add text and images to create a dynamic promo product. The design phase works great, and I use html2canvas to turn their custom product into an image. The image looks great for the screen but is not suitable for printing, which is the ultimate goal.
How can I scale up HTML content (retaining the detail) and save the results as an image (png) ?
I have successfully scaled the image AFTER putting the web content on a canvas, but that clearly loses detail.
I have used the CSS3 "transform" property to scale my image BEFORE applying the content to the canvas. That works and retains the detail and proportions nicely. However, html2canvas ignores that CSS and exports the original size (as confirmed here: https://github.com/niklasvh/html2canvas/issues/176 )
Anyone have experience doing this?

Multiple image sizes vs browser image resizing / scaling

I have a page where I will be loading a couple of different sizes of the main image; although not all the large images will be loaded at once.
The scenario is this..
I have a slider which contains the thumbs for all the larger images; these all load when the page does.
The default large image loads when the page does, but the other large images only load if the user clicks on the thumbnail for that image and then I replace the src of the large image as so..
function changeMainImage(image) {
// Set big image
var big_image = image + '-big.png'
// Update main image url
jQuery('#main_image').attr('src', big_image);
}
Now because the large images don't load when the page does, this causes a small delay for the large image to show, which is rather undesirable.
Now I'm thinking that I could kill two birds with one stone with just loading the large image and no thumbs and just have the browser scale the large image into a thumbnail; I just kinda cringe at doing it this way as I have always hated sites that use this method for thumbs, but in my case it seems valid as I need to load the large image anyway.
This would allow me to reduce the number of http requests by 1 * amount of pics and also give me instant load of the large images once the thumb is clicked.
My only concerns are trying to figure out how to give the browser the correct dimensions so that the image scales to the correct proportions and also the fact that if the page has say 12 images; this way I am making the user download all 12 large images at once when they make not even be interested in looking at all 12.
Both versions have pros & cons - any advice what to do here?
The method you currently have is what I prefer to do. Load what is visible.
Now, to make the user experience better, many sites use a couple techniques. The first would be to pre-load the next image or two. If you have a slideshow-like display and have a good idea of what order the images will be displayed in, this is good.
The second is to display the thumbnail while the large version downloads. If your thumbnails are of a decent size, this lets the user get visual feedback that their click worked, and on decent connections the image will be downloaded soon after.
Finally, I recommend using progressive JPEG (if your images are photos) so that they are enhanced as they load.
For your data on sizes (and any other metadata), keep that in a JavaScript array of objects, or wherever else you store your image data. You can easily use JSON for transit from the server.

Categories

Resources