Post by oc_ms » Sat Sep 02, 2017 3:53 am

Hello opencart users!

I have created a sym link (ln -s) under "upload/images/catalog" to an image directory within the server. I can access it in the shell without any problems. If I go to the file manager to upload an image to a product I can see the directory. But when I click on it, no files within the directory are shown.

Has anyone an idea how to access "sym link"-directories?

Best regards,

Holger

Newbie

Posts

Joined
Thu Jun 05, 2014 3:25 am

Post by yodapt » Sat Sep 02, 2017 4:21 am

What permissions have you set to those folders?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by oc_ms » Sat Sep 02, 2017 4:49 am

> What permissions have you set to those folders?

Hello yodapt!

Permissions are set to 777 just to except the permission problem.

Bye,

Holger

Newbie

Posts

Joined
Thu Jun 05, 2014 3:25 am

Post by yodapt » Sat Sep 02, 2017 4:55 am

Try +x or a+x

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by haxcop » Sat May 16, 2020 6:43 am

HI guys interested on this particular topic. I have tried using this approach but doesn't seems to work ok OC 3.x
I have also renamed the DIR_IMAGE directly to the folder I want to try but at this instance what I get is only broken links images
any ideas to properly use this approach to storage the images, Is possible ?...

New member

Posts

Joined
Tue Jan 14, 2014 9:38 pm
Location - Dublin

Post by straightlight » Sat May 16, 2020 7:44 am

haxcop wrote:
Sat May 16, 2020 6:43 am
HI guys interested on this particular topic. I have tried using this approach but doesn't seems to work ok OC 3.x
I have also renamed the DIR_IMAGE directly to the folder I want to try but at this instance what I get is only broken links images
any ideas to properly use this approach to storage the images, Is possible ?...
Ensure your DIR_IMAGE 's sub-folders also matches your sub-folder names on the database aside from the permission issues. As for the folder permissions themselves, ensure to apply those changes from FTP.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by haxcop » Sat May 23, 2020 5:55 am

straightlight wrote:
Sat May 16, 2020 7:44 am
haxcop wrote:
Sat May 16, 2020 6:43 am
HI guys interested on this particular topic. I have tried using this approach but doesn't seems to work ok OC 3.x
I have also renamed the DIR_IMAGE directly to the folder I want to try but at this instance what I get is only broken links images
any ideas to properly use this approach to storage the images, Is possible ?...
Ensure your DIR_IMAGE 's sub-folders also matches your sub-folder names on the database aside from the permission issues. As for the folder permissions themselves, ensure to apply those changes from FTP.
thanks for your reply.

In fact, I did - my paths are like this

DIR_IMAGE, '/my/other/path/images/[same as the default]'
the permissions and group/owner of the folders and files are the same as original
now in regards of the Database. could you please explain a bit better?
in the db tables where images are found remains intact as it should be for example:
catalog/pics/31882.jpg
and match the same folder structure

Thanks

New member

Posts

Joined
Tue Jan 14, 2014 9:38 pm
Location - Dublin

Post by straightlight » Sat May 23, 2020 8:46 am

now in regards of the Database. could you please explain a bit better?
Ensure your image field values in the product table follows the same sub-folders path as well as in your product_image table.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by opencartmart » Sat May 23, 2020 2:51 pm

oc_ms wrote:
Sat Sep 02, 2017 3:53 am
I have created a sym link (ln -s) under "upload/images/catalog" to an image directory within the server. I can access it in the shell without any problems. If I go to the file manager to upload an image to a product I can see the directory. But when I click on it, no files within the directory are shown.
You can not see images from symlink because it converts to the real path before serving and OC ensures images are serving from the `catalog` directory

One workaround could be removing `realpath()` function from files `admin/controller/common/filemanager.php`, `admin/model/tool/image.php`and `catalog/model/tool/image.php`
Though you may face other repercussions as the function `realpath()` is intended to resolve `relative to absolute` path as well. So use your own risk.

XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart


Active Member

Posts

Joined
Wed Oct 02, 2013 3:59 am

Post by support@gottires.com » Sat Jan 09, 2021 8:00 pm

opencartmart wrote:
Sat May 23, 2020 2:51 pm
oc_ms wrote:
Sat Sep 02, 2017 3:53 am
I have created a sym link (ln -s) under "upload/images/catalog" to an image directory within the server. I can access it in the shell without any problems. If I go to the file manager to upload an image to a product I can see the directory. But when I click on it, no files within the directory are shown.
You can not see images from symlink because it converts to the real path before serving and OC ensures images are serving from the `catalog` directory

One workaround could be removing `realpath()` function from files `admin/controller/common/filemanager.php`, `admin/model/tool/image.php`and `catalog/model/tool/image.php`
Though you may face other repercussions as the function `realpath()` is intended to resolve `relative to absolute` path as well. So use your own risk.
i do not see realpath() in - admin/controller/common/filemanager.php, in OC version 3.0


Posts

Joined
Wed Nov 18, 2020 4:53 am

Post by gerstavros » Thu Oct 28, 2021 5:06 am

The only way to work this, is instead of creating symlink, to bind mount one folder to another
For example in fstab:
/var/www/{site where you have the images}/html/image/catalog/products /var/www/{site where you want to symlink}/html/image/catalog/products none defaults,bind 0 0

New member

Posts

Joined
Mon Apr 04, 2016 12:44 am
Who is online

Users browsing this forum: No registered users and 190 guests