How to load images with relative path in image control? - relative-path

I have a c# program in which it need to load a main image and its thumbnail in image control for which I need to use their relative path. All the main images are stored in a folder "images" and their thumbnails are stored in a sub-folder "thumbs". And, all the thumbnails have exact same name as the main images. I know how to give relative path for a specific file but I don't know how to give relative path for dynamic file. In other words, how do I give the dynamic filename for both main image and its thumbnail image holder? i.e. instead of xyz.jpg, there can many other image name, how do i do it?
<div>
<img id="ProductMain" src="\Business\images\xyz.jpg" alt="Mountain View" style="width:150px;height:100px;">
</div>
<div>
<table>
<tr>
<td><img class="thumbnail" src="\Business\images\thumbs\xyz.jpg" alt="Img1" style="width:30px;height:25px;"></td>
</tr>
</table>
</div>

Related

how to take assets from an external application folder in Vue?

I have a folder with images and folder with vue-app(archy)
so i need to get in components those images
I tried something like this, but didn't succeed
<div v-if='photo' class="post-img">
<img :src="`~#/../../uploads/posts/${photo}`" alt="img">
</div>
any suggestions?

html to pdf ASP.NET.Core 1.1 image not showing after conversion

I am using this open source library for html to pdf. Everything is working, but when it comes to adding a <img src> tag, it is not showing the image I want in PDF. For example,
string image = "~/images/test.png";
string htmlToConvert = string.Format(#"
<div>
<table>
<tr>
<td>
<img srcset='{0}'>
</td>
</tr>
</table>
</div>", image);
Is there anything wrong with my format or is it simply just not supporting images? If it is true, any working library for asp.net core 1.1? (important because some libraries/suggestions were based on 1.0 which contained project.json file)
p.s. I am going to deploy it via Azure web app service
The image must be in the same folder as where the phantomjs executabels are.
Just take a look at method
PdfGenerator.WriteHtmlToTempFile
There you can see that your html is stored into a file in the phantomjs-installation directory. And this is the root of your html-file, which means that the images must be there too.
https://github.com/TheSalarKhan/PhantomJs.NetCore/blob/master/PdfGenerator.cs.
I suggest that you use the phantomjs-executabels directly to better understand what is going on.

How to make work DataURL and Lightbox together

I want to use Lightbox. Images are binding from back-end in VB.NET(database-sqlserver).
Here is HTML which is inside a datalist controler:
<a href='<%# Eval("images")%>' rel="lightbox[Brussels]">
<img alt="" src='<%# Eval("images")%>' height="150" width="150" class=" img img-thumbnail" />
</a>
I am not storing the images filepath. Just storing the images in varbinary(max) So cant give href attribute of Link.
I referenced hyperlink href attribute via dataurl.Its value is coming in base64
dr("images") = "data:Image/png;base64," & Convert.ToBase64String(imgbyte)
where imgbyte is byte array().
Whenever I am clicking on the Image(binded from database),it should come in front using Lightbox.
But problem is arousing as image poping out is partial clear or 30% clear rest blured or nothing at all.Don't know the exact reason why?
I have read somewhere that Internet Explorer 6 or 7 is not using dataurl. And it can show upto 32kb size image. But I have checked it in IE11.It does't work.
Any possibility how can we show images of big size using dataurl in LightBox?
Any other possibility how can we achieve this?
The only way I see is to implement a custom endpoint, say Generic Handler or a more tailored one, which returns a proper binary stream by providing the Identifier of the corresponding image.
For example
/MyCustomImageProvider.ashx?Id=1
This endpoint will be reachable via URL and such URL can be fed to LightBox, while keeping your images stored in a Table rather than a physical file.
In the end, your aspx code could like the following
<a href='<%# Eval("images")%>' rel="lightbox[Brussels]">
<img alt="" src="/MyCustomImageProvider.ashx?Id=<%# Eval("imageId")%>" height="150" width="150" class=" img img-thumbnail" />
</a>

Sphinx : png's are not shown on a generated PDF

This is my first Sphinx project and I am trying to create a cross platform documentation on HTML, ePub and LatexPDF. The issue is that the static PNG's are shown via the HTML and ePub version but not in the PDF file. What am I missing so that the PNG are also showing up in the PDF ?
<p align="center">
<img width="100%" height="100%" src ="./_static/organizations.png" />
</p>
Found a solution :
![Some Text](../../../_static/UIListener1.png)
instead of the HTML ...

nitmedia/wkhtml2pdf images not working on laravel

I've included the package, the pdf gets generated but somehow the images dont appear on the pdf. The HTML content and CSS works like expected.
When i return the view as how you'd normally return a view in laravel, the receipt displays nicely along with the images.
But when i:
return PDF::html('receipt.show', $data);
The images dont appear.
My view file has the image like so:
<img class="img-responsive" src="img/receipt/banner.jpg">
The image is within:
public/img/receipt/banner.jpg
This is a laravel app running on homestead environment.
You need to use absolute path in image src attribute instead of relative. Smth like:
<img class="img-responsive" src="http://your-domain.com/img/receipt/banner.jpg">
You can use
<base href="http://your-domain.com/" />
into your head and it will help for all your links