Laravel image storage

this is my working website:

i recently learned about summernote and tried the webiste by saving posts on my local machine first and its working correcty

my worry is, if i update my project, will infinityfree allow image saving on its server like the one happening on mine

im using laravel framework by the way

thanks for your help and guidance.

I don’t know where does this doubt comes from. How on Earth you’ll be building a website without images?

So of course, images are allowed, as long as it’s website content.


well, i guess i need to update my files to find out…

im just a little skeptical (if that is the word to describe it) because the images are not loading when i accessed my laragon site on my mobile device…

and i read something about symlink not working, so it added doubts and fears ahahaha

Ok, so I just updated my infinityfree files, I was able to post, but the image thumbnail is not appearing as it was compared to my local machine. Is there something that I missed?

Which storage driver for Laravel do you use exactly? And how is it setup?

I suppose that in most cases, you would use the local storage driver, but that places your files in the storage, not the public folder. Normally, you’d create a symlink to link the public/storage/ path to the storage/app/public/ path, but that’s not possible on our hosting.

I think it’s possible to work around this with .htaccess rules, with the exact rules depending on how exactly you setup Laravel.


i just used this to save my image:

Storage::disk('public')->put($imagePath, base64_decode($imageData));

and also to get the first image of the post:
$dom = new DOMDocument();
$img_tags = $dom->getElementsByTagName('img');
$thumbnail = null;
foreach ($img_tags as $img) {
$thumbnail = $img->getAttribute('src');
break; // Get only the first image

so i guess this way is not the efficient one to save and get my image from the site.
i will try to look for the .htaccess rules you mentioned. thank you for your reply and quidance

use Illuminate\Support\Facades\Storage;

this was the storage driver i believe.

It isn’t. A Facade is just a helper to let you easily access storage functions. A more useful clue is this one:

Which is what I suspected, and means what I said before applies:

I think what you want can be done with .htaccess rules, but I don’t know which exact rules will work for this. Maybe you can find some examples online on what could work.


ok, maybe I am doing this wrong and not really sure if this is the proper venue for this but could you give me a hint as to how i should code or edit my htaccess file?

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Allow access to the images directory
    RewriteCond %{REQUEST_URI} !^/public/images/posts/ [NC]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.