CodeIgniter Forums
CI4 image not found problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: CI4 image not found problem (/showthread.php?tid=81383)

Pages: 1 2


CI4 image not found problem - serialkiller - 02-22-2022

Inside the public folder I have a folder called "upload" which contains other sub folders that contain images.
I can't see any images from any of these paths:

https://website.com/upload/files/personal/13348/image_one/123.jpg

or

https://web.codigniter4.it/public/upload/files/personal/13348/image_one/123.jpg

and also with relative url


RE: CI4 image not found problem - seunex - 02-22-2022

You can try <?= base_url("path/to/image.jpg"); ?>

No need to include public in the path above.


RE: CI4 image not found problem - serialkiller - 02-22-2022

(02-22-2022, 07:07 AM)seunex Wrote: You can try <?= base_url("path/to/image.jpg"); ?>

No need to include public in the path above.

Generate the same url: https://website.com/upload/files/persona...ne/123.jpg

so I still don't see the image


RE: CI4 image not found problem - seunex - 02-22-2022

Then the image is uploaded else where


RE: CI4 image not found problem - serialkiller - 02-22-2022

(02-22-2022, 10:10 AM)seunex Wrote: Then the image is uploaded else where

No, the image is already present in the folder, I am converting a project from CI3 to CI4, I assume that also for the upload there will be the same problem, but solved here should also be solved there.

Obviously the folders and the image are present but it is not reachable for some reason


RE: CI4 image not found problem - seunex - 02-22-2022

Let assume ur upload path is located in the public. Any time u see base_url() it already point to the public. I found no reason why the image should not be rechargeable.

Try

<?= FCPATH.'path/to/image.jpg'; ?>

This will return the system relative path.


RE: CI4 image not found problem - iRedds - 02-22-2022

If the file exists in a directory that is DOCUMENT_ROOT, the URL matches the path and the file is not returned, then you need to look for the problem in the web server settings.


RE: CI4 image not found problem - serialkiller - 02-23-2022

(02-22-2022, 12:37 PM)iRedds Wrote: If the file exists in a directory that is DOCUMENT_ROOT, the URL matches the path and the file is not returned, then you need to look for the problem in the web server settings.

The problem is that the version in CI3 runs on the same ecosystem and the images are visible, the only thing that changes is the version of CI, so I don't think it can be a web server setting


RE: CI4 image not found problem - iRedds - 02-23-2022

CodeIgniter, like any other framework, will not be used if the URL specifies an existing file in the web server directory.


RE: CI4 image not found problem - serialkiller - 02-23-2022

(02-23-2022, 02:04 AM)iRedds Wrote: CodeIgniter, like any other framework, will not be used if the URL specifies an existing file in the web server directory.

I didn't understand the answer, however it was my mistake, I made a mistake in setting the $baseURL variable, now everything works, thanks