Codeigniter Mpdf image not shown in header - image

I've a problem with mpdf and Codeigniter: i'm printing an html page right if I load just simple text.
If I add an image in my header by
$mpdf->setHTMLHeader(site_url("assets/img/my_image.jpg"));
The browser load for minutes and then download a pdf file with a red X intead of my image. It seems my image link is broken, but it's not: i've checked it.
I've thought it could be a permission issue so I changed my img folder's and files permissions to 777, but nothing has changed...
Any ideas on how to solve it?

I think that problem is in relative path for image, even if the web browser is fine with them and display the images correctly.
Try to generate a path with an absolute base URL.
<img src="full_path/assets/img/my_image.jpg', true) ?>" alt="my_image" />
Or try to use base64 image.
Also you can set debug to true and see what is error (sometimes is GD extension)
$this->_mpdf->showImageErrors = true;

Related

Image not displaying correctly in Blade Laravel template

I need to generate qr-code and for this I use this package https://github.com/SimpleSoftwareIO/simple-qrcode
qr-code is generated in png format and I save it to the right place in the file system. Also, I write the path to this file into the database. The file path is always '../storage/app/public/' . Auth::user()->id . '/qr.png'. Every time a new file is generated, I overwrite the old one.
The problem is this. In the template, I am trying to display this image in the saved path and it is displayed but not correctly.
For example, I have a qr-code in a template, next I generate a new one and expect to see it, but the old image is displayed, which has been overwritten. Normal reloading of the web page does not help. Everything works correctly if you reload the cntr+f5 page
Is it a cache issue or something else?
I think it's not a laravel issue, it's a browser "feature".
Have you tried to add a parameter to the image path to force browser do not cache the response?
<img src="{{ url('/storage/' . Auth::user()->id . '/qr.png?v=' . time()) }}" alt="My newest QR code">

Image not found in laravel

My application is displaying images perfectly as I am displaying them on the other pages.
I need to apply a watermark on all of those images.
Whenever I try to get the image dynamically to manipulate it gives me the error 404 not found.
However, the link is similar to all other images displaying on the website.
I have tried Image intervention It works fine for the images in public/img folder
but id does not work for the images in the storage/app/products folder.
link:http://usm.gondalgroup.com/refurbished_tetra_pak_machines_supplier_home
working link obtained by inspecting image:http://usm.gondalgroup.com/storage/app/products/pRComIu5U3TkCSppb2PsjxtkcmgpFk4ZGbq4mbRt.jpeg
The link I made using controller and loop: http://usm.gondalgroup.com/storage/app/products/B6ITcW8iA4gyVKbqylw3qweGsqTLMjslIyyvIjes.jpeg

I am new to the Laravel. I got this project and I don't know why this is not displaying pictures

Things I tried
1.simple path without URL::to
2.url() method
3.absolute path
4.asset(simple relative path)
in my .env file changed APP_URL from http://localhost to http://localhost:8000 since it runs on 8000 port
I am adding some pictures.
One thing which is important to mention here when i use Simple relative path it shows picture on hovering the mouse in IDE and on browser too but browser does not render it on webpage.
Please see pictures
src="{{URL::to('public/imgs/2.png')}}"
You have to put all your image resource files in public folder then access those resources through the following way:
src="{{ URL::asset('imgs/2.png') }}"

Image upload error using HTmlExtendEditor

I am using Ajax htmleditorextender to upload a image.
In local solution, able to upload the image successfully.
Once I published into IIS, Image upload is not happening.
Please Find the attached Screenshot for the same.
enter image description here
It seems you set up AjaxFileUploadHandler.axd incorrectly.
Please make sure it is located at the root path of the web site or adjust AjaxFileUploadHandler path in Web.config accordingly.
Here is the relevant issue: https://github.com/DevExpress/AjaxControlToolkit/issues/43#issuecomment-203889967

tinyMCE add image

I have problem with tinyMCE. If I add image from external url (http://www.somesite.com/image.jpg) all works perfect and and the image will show in my text. But if I add an image from a folder on server, the image will not show because I use htaccess to rewrite the url.
Web domain: www.web.domain.com
If I insert image from www.web.domain.com/images/img.jpg and show this text on the page www.web.domain.com/en/Category-1/, the image doesn't show because tinyMCE adds img src as "./images/img.jpg"
Any idea if it is possible to turn this off?
Probably due to TinyMCE using relative URLs by default. Check out the FAQ entry on the TinyMCE site for the various settings that might help.

Resources