octopress-avatar: where is the avatar image file? - octopress

The path to the avatar is not described.
Where should be stored the avatar in order to use this plugin.
in source/images ?

You can put a url straight in the config file:
avatar_url: http://www.foo.com/avatar.jpg
so you might as well upload the image in your directory and use the full url for it in the config file.
avatar_url: http://www.foo.com/images/avatar.jpg

Related

PHPExcel Load image from outside URL

Does anyone know how to make setPath() method able to load an image from outside server? Because all images is store on other server.I don't have any idea how to do that. Please help me. thanks
<pre>
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath('http://domain.com/images/testing.jpg');
$objDrawing->setHeight(96);
$objDrawing->setOffsetX(27);
$objDrawing->setOffsetY(40);
$objDrawing->setCoordinates('A9');
$objDrawing->setWorksheet($this->excel->getActiveSheet());
</pre>
Images can't be referenced from a URL, you need the image in your local filesystem because PHPExcel needs to extract information from that image. Use curl (or even file_get_contents()) to pull the image to the local filesystem first. Once the image has been embedded in the Excel document, you can delete the file again.
You can put false as the second option in the setPath() method. Tcpdf gets the image from the URL and PHPExcel doesn't throw an exception.

Save image on server

I have a BufferedImage in my jersey post call and would like to save it on the server. I can save it to the file system but I want to save it to the server img folder.
EG localhost:8080/server/img
How do I achieve this?
Use the getRealPath() method of the ServletContext ServletContext.getRealPath to find out the actual directory in your filesystem and save it there. In your case it can be like
String realPathOfImgFolder=req.getServletContext().getRealPath("/img");
Then save the file to this location and it will be available by http://localhost:8080/server/img/<image file name with extension>

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