how to get image Details form mobile folder location - image

We have image path like
cdvfile://localhost/persistent/DCIM/Camera/1395167011485.jpg.
OR
file://localhost/persistent/DCIM/Camera/1395167011485.jpg.
We need get image details using this path.Image details like Image Name,height, width.We are developing Cordova mobile apps.Please guide to us .Which plugin we need use for Details.

You don't need a specific plugin, though you could use file transfer to help with it. Something like the following will work fine:
var image = document.createElement('img');
image.src = "img/My_Image.png";
console.log(image.height);
console.log(image.width);

You might find this javascript exif library useful.

Related

InlineQueryResultArticle - thumb_url uploaded image

Is there an option to use an image uploaded to telegram (file_id couldn't do it) inside InlineQueryResultArticle thumb_url?
notes:
I tried to get the file path using getfile() but it didn't do the trick.
even tried to upload a very small image size with no luck.
I'd like to ignore the InlineQueryResultCachedPhoto option since the design is not the same
any thoughts?
thank you!
I also checked that the telegram does not show the uploaded image, I think it is better to give the address of the picture directly.

Can you use a URL to embed an image inline in MVCMailer

In looking at the MVCMailer step by step, I see that you can embed images inline using cid in the HTML.
https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide
I see the code that talks about embedding:
#Html.InlineImage("logo", "Company Logo")
var resources = new Dictionary<string, string>();
resources["logo"] = logoPath;
PopulateBody(mailMessage, "WelcomeMessage", resources);
My question is rather than use a path within the site like:
resources["logo"] = Server.MapPath("~/Content/images/logo.png");
Can I somehow get at images I have in the Azure Cloud or S3 Cloud where I have plenty of space?
Please let me know if there is a way to get the image from some other source than the server the MVC mailer is running on.
Thanks,
Victor
In Server.MapPath(my_path), my_path, specifies the relative or virtual path to map to a physical directory. Server.MapPath is related with local FileSystemObject so in that case it will look for the file (you pass as parameter) in a location within local web server. More info is described here:
http://msdn.microsoft.com/en-us/library/ms524632(v=VS.90).aspx
So if you image is located at http://azure_storage_name.blob.core.windows.net/your_public_container/image_name.jpg, the passing it to Server.MapPath() will not work as this is not a location in local file system. I tried and found that it will not accept and I also try to tweak a few way but no success. IF you can change the code behind and which can access the resources from a URL then it will work otherwise not.

iText Add Image to PDF in a web application

I'm posting this for a friend. He is not able to access Stackoverflow from work (Third Party Cookies Appear To Be Disabled) :)
Ok here goes:
They have a Web application (JSP/Servlets/Custom Framework) and he is trying to generate a PDF on the fly. Now he wants to add images to that PDF. But it ain't working. Here is the piece of code:
Image image = Image.getInstance("../graphics/caution_sign.gif");
The graphics folder is on the parent project (webcontent/graphics/) and this is how they access the images from that folder in all other places (in the JSPs).
Now I read on another post that we need to use the real absolute path to access the Images. But the problem here is this is a POJO and there is no access to the servletContext in this class.
The PDF is generated fine, but the Image does not show and the error is:
C:\Program Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\..\graphics\caution_sign.gif (The system cannot find the path specified.)
It is trying to look for the "Graphics" folder in a different location instead of looking within the webcontent folder.
Hope my question is clear and would appreciate a lot if someone can help with this and help in resolving this issue
Thanks so much
Harish
He was able to solve it using this piece of code. Hope this helps someone else.
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String path = classLoader.getResource("/graphics/caution_sign.gif").getPath();
Image image = Image.getInstance(path);
Thanks
Harish
Following code can be used to access image path inside a java class.
URL imageUrl = getClass().getProtectionDomain().getCodeSource().getLocation();
Image img=Image.getInstance(imageurl+"../../../some/images/pic.gif");
Small change from the previous solutions :
Step1: Below code will return the class path including class file name
URL classURL = getClass().getProtectionDomain().getCodeSource().getLocation();
Step2: Get the base path by removing class name
String basePath = classURL.getPath().replaceAll("<classname>.class","");
Step3: Navigate to the image location based on your project
Image headerLogo = Image.getInstance(basePath+"../../../../../../../images/header_logo.gif");

Provide url and store image from the url in a file in file system in groovy

I am doing a project in grails using groovy to upload an image. I have been able to fetch a file from my-computer and store it in a location and display it from there. I wish to accept a url from the user during run time and store the image in the locaion and display from there. Help please
Please consider Gregg's comment, but if you stay with your idea, this is the way I would do it:
new File("path/to/local/image.jpg").bytes = new java.net.Url("http://url.from.user/image.jpg").bytes

Trying to use image from URL with Kohana Image class

I'm trying to use an image from a URL with Kohana image class. http://kohanaframework.org/3.0/guide/api/Image
Is this possible or does the image always have to be local to the project?
I'm accessing the image like this:
http://www.mysite.com/temp/myimage.jpg
from the same site.
However the temp folder in the above URL is actually an Alias in Apache so is outside of the document root.
Can anyone shed any light on a solution?
The kohana image library says its not an image because it either fails
realpath($file);
or
getimagesize($file);
Cheers.
The image does have to be local to the project.
What you can do is grab a copy off the remote and save it to your project and serve that.
$offsite_path = 'http://example.com/images/steve-buscemi.jpg';
$local_copy = Remote::get($offsite_path);
$local_path = 'images/steve-buscemi.jpg';
file_put_contents($local_path, $local_copy);
echo HTML::image($local_path);
There is a feature request to allow for remote image access using the Image module.

Resources