How can show image at view from webroot - image

I am trying to show image at view from webroot in cakephp.
But I didn't get any image. Please help me;
Is this code correct
$this->Html->image('WWW_ROOT . img/upload/aswq.png', array('width'=>'200px'));

you can use in this way to show image from webroot folder. just notice that img folder already included path in html helper
echo $this->Html->image('upload/aswq.png', array('width' => '200px','alt'=>'aswq'));
Will output:
<img src="/img/upload/aswq.png" alt="aswq" />
let me know if i can help you more.

Related

Thymeleaf doesn't show images

I'm showing images from resources/static/images/
The weird thing is if I give the path like "/images/milk.png", it shows the image but if I get name from ${}, it doesn't work.
<img class="card-img-top"
th:src="#{/images/${res.getLogo().getUploadFileName()}}"
th:alt="${res.getLogo().getUploadFileName()}" />
it seems res.getLogo().getUploadFileName() is working well. So it will be replaced like /images/milk.png. But it doesn't show the image...
How can I fix this?
One more thing, I know basic Thymleaf path is resources/templates, but how it recognize image when I gave like "/images/milk.png"
If u want to upload static images
th:src="#{images/} + ${res.logo.uploadFileName}"
if you want to upload dynamic images
th:src="#{https://~~~.com/} + ${id}

cant use local image as src laravel-mix vuejs

I have a Vue component located at resources/js/modules/MyComponent.vue and inside it, I'm trying to use a local image as an src for the img tag, and the image is located at public/assets/myproj/image/myimage.png.
I've tried using the following :
<img src="#/assets/myproj/image/myimage.png"/>
<img src="require('assets/myproj/image/myimage.png')"/>
<img src="../../../public/assets/myproj/image/myimage.png"/>
<img src="/assets/myproj/image/myimage.png"/>
but none of them work...
I know this is a straightforward question but I hope someone can help me because I've been trying to find an answer for almost an hour now but I still can't figure it out.
If you want to use this in javascript you can do like this
<img :src='getImage(name)'/>
then you will need to import your image in your javascript code
getImage(name){
return require(`#/assets/myproj/${name}`);
}

How to show image form another folder in laravel 5.2

I want to show picture form another folder. But why it's not working?
<img src="/picture/Capture.JPG" style="width:600px;height:400px">
My folder name is picture and image name is Capture.JPG
To print images ,css and js files correct path laravel have a default function asset()
Try this
<img src="{{ asset('picture/Capture.jpg') }}" style="height:400px;width:400px" >
I find my solution last night.
At first i create a folder in public folder name images. Then i store the picture. And the code formet is here.
<img src="{{url('/images/6.JPG')}}" alt="Image"/>

How to display uploaded images in pdf using wkhtmltopdf

I am using Carrierwave to upload images in rails4.
In the html view page the image is showing. But, when generating the pdf, from this view, the image is not showing.Instead , a blank box is showing.
From the view, while inspecting the path is showing as below:
<img alt="Small images" src=" http://127.0.0.1:3000/upload_
files/6/student/image/1/small_images.jpg">
The code i used is:
<%=image_tag Student.find(id).image_url(:small) %>
If the image is stored in app/assets/images, then the images will appear.But, i need to upload the image in this location only.
Can u pls help...
Thanks in advance.
I could do it with php Laravel this way >>
<img alt="Small images" src="{{base_path().'path/to'image.jpg'}}">
I have no experiences with Ruby , but try to find something similar.

How to add a photo-image to the comment system on my gallery?

I have a problem linking no the href of the image, but the src of the image in the comment system....
I have the following:
<div class="fb-comments" data-href="http://eurosalute.altervista.org/search/?type=fotogallery&uri='.$urlimage_encrypt.'" data-num-posts="5" data-width="370"></div>
the problem is that not showed the image src, but only the link href on my gallery..
I need to show the image src in the comment system on Facebook.
For example: add a data-picture="http://eurosalute.altervista.org/search/'.$urlimage.'" or a data-src to the div, where $urlimage is the url of the image to diplay.
Please help...
Thank you,
Regards,
Rodolfo

Resources