P81CFM's avatar

Confusion between local development and online development with the use of Intervention Image Library and storage link

Hi guys,

I have a Laravel app which works fine on my local environment. One functionality allows me to modify an image in order to create few versions of different sizes of the image uploaded (Intervention Image library operates at this level) and put them each one in its "version" folder. All these folders are under the directory public/storage/img/authors/ {multiple_folders_one_for_each_size} . I used the command "php artisan storage:link" to create storage folder within public.

Now that I'm deploying the app online I realized that the images are not saved in the public/storage/img/authors/ but instead in the storage folder (the default one outside the public folder). The name of the image is: app\public\img\authors\92\92_author_203_george_13a784edae.jpg instead of: 92_author_203_george_13a784edae.jpg

Even online I create the link with the command "php artisan storage:link" and received the message that the link has been created.

Here is the line of code that I use to modify and save the image (and works locally) Image::make($upload_file->getRealPath())->resize(92, 92)->save( storage_path( 'app\public\img\authors\92\92_' . $name_image ) );

The original file which is saved using the following code: Storage::put('public/img/authors/original/'. $name_image, fopen($upload_file, 'r+')); is correctly stored under the public/storage/img/authors/[original] directory.

Not sure how to navigate through this issue

0 likes
2 replies
jlrdw's avatar

If Linux, try making the link with command line. Just suggestion.

Edit: Also are any of these images private user images? If so I have a link of how to secure images.

1 like
P81CFM's avatar

Hi thanks for the reply,

on the online server I have linux, and what I did to run the "php artisan storage:link" I used a SSH, and it works apparently.

Those images won't be private but thanks for the offer

Please or to participate in this conversation.