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.
Storage::disk('public')->put($imagePath, base64_decode($imageData));
and also to get the first image of the post:
@php
$dom = new DOMDocument();
$dom->loadHTML($post->content);
$img_tags = $dom->getElementsByTagName('img');
$thumbnail = null;
foreach ($img_tags as $img) {
$thumbnail = $img->getAttribute('src');
break; // Get only the first image
}
@endphp
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
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]
</IfModule>