To share image resources through several sites in same server account

  • Posts: 634
  • Thank you received: 16
7 years 4 months ago #256289

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6.25
-- Browser(s) name and version -- : Any

I have three different sites in the same server under the same account.

I managed to use massactions to clone products form site A to site B and C (with the great help of your support team some months ago) so I only have to maintain products in one site.

Now I need to unify all images in one single “upload” folder to both save disk resources and avoid creating a process to send images to secondary sites.

So one of my plans is to move the “upload” folder to the root of the site, just before the public_html and subdomain folders.

Another option would be to save the images to a common resources site with another domain name and maybe in a different server.

Maybe best option is that images are originally stored in the site A where I edit the products, then site B and C call the “upload” folder in the Site A domain.

Site B and C will show images and demand creation thumbnails but not delete any image.,


What are the possilbilities? What troubles will put HikaShop or Joomla to call images from product_list and product_view that are stored in

a. another server?

b. another site with another domain name?

c. a folder in the account root out of the basedir of the site?



Thank you.


-- Víctor

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 4 months ago #256298

Hi,

If all the websites are on the same server, then it's really easy. You just need to run one command line on your server's bash to create symbolic inks to folders:
stackoverflow.com/questions/9587445/how-...-link-to-a-directory
So it's like a virtual folder which is seen as a normal folder by everything on your server but actually directly provides the content of the folder it is linked to.
That way, you can have one upload folder and link the other ones to it transparently through all your websites on the same server.

The following user(s) said Thank You: PeterChain

Please Log in or Create an account to join the conversation.

  • Posts: 634
  • Thank you received: 16
7 years 4 months ago #256454

Thanks Nicolas, this seems really simple and interesting.

Now,

If I had to show my images in product view and prodcut lists and HikaShop Content modules in www.siteB.com

while the content is stored in

www.siteA.com/media/com_hikashop/upload

would this be feasible with few controlled code hack or parameter forced directly to the HikaShop confgiuration tables or whatever?

I would accept that each update required the hack to be made again.

All ideas will be appreciated. Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
7 years 4 months ago #256486

Hi,

If both websites are on the same server and you create a symbolic link between www.siteA.com/media/com_hikashop/upload
and www.siteB.com/media/com_hikashop/upload then there is nothing to do. Just select the images in the upload folder for the products of siteB and it will work.
If they aren't, then it will require modifying the code, one way or another.
In that case, you could for example create a custom product field and put in there the URL of the image for each product and then override the view files displaying the images in the frontend to use the content of the field as src of the img tag instead of generating it dynamically. As it would be done with view overrides, it wouldn't require to do the modifications again after update.

Please Log in or Create an account to join the conversation.

  • Posts: 634
  • Thank you received: 16
6 years 9 months ago #272832

Hi,

we are in "half working / halg not working" situation:

we have site A where all products are created and maintained.

we have site B where products will be shown / sold by importing some of the products from site A (we coded our own exporter between sites).

both sites are in the same server so we asked the administrator to make a symbolic link from upload folder on site B to upload folder on site A.

This works but just half the way:

From site B i can access uploaded images stored at upload root folder in site A.
But my site B is not able to access nor create any thumbnail folder on the linked folder in site A.

this si the strucuture of my paths:

siteA.myserver.com/images/com_hikashop/upload/sc-7038-01web.jpg --->This file exists and is viewable from my browser

siteb.myserver.com/images/com_hikashop/upload/sc-7038-01web.jpg --->This file DOES NOT EXIST but is viewable from my browser thanks to the "site A symbolic link"


siteA.myserver.com/images/com_hikashop/u...0f/sc-7038-01web.jpg --->This file exists and is viewable from my browser

siteb.myserver.com/images/com_hikashop/u...0f/sc-7038-01web.jpg --->This file DOES NOT EXIST but should be viewable from my browser by linking to the "site A symbolic link"

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
I found this "Thumbnails not creted" forum thread that is debating this but seems like they are using the JMS Multisites component so is of no use for us.

We need a far more use solution for which thumbnail folders and images can be accessed cross sites.

We will accept a "hard coded override" solution even if we have to reapply it at every HikaShop update. But we need your help on finding the alternative code.


Thanks,

Peter Chain.

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
6 years 9 months ago #272853

Hi,

Since 6 months ago, HikaShop now supports external images.
So when you add an image to a product, instead of uploading the image or entering the path of the image in the upload folder, you can also specify a URL.
So use the upload system on one website, and then enter the URL of the image on the other website and you'll be set.

Otherwise, without changing anything to your website or to HikaShop with the "half the way" solution you already have, all you need to do is to create a simbolic link between the upload folder on both websites since they are on the same server and that should do.
You'll have to properly set the permissions and it will work. Unfortunately, we can't help with that. It's not a matter of changing code in HikaShop but for your server administrator to properly configuring the symbolic link on the server.

The following user(s) said Thank You: PeterChain

Please Log in or Create an account to join the conversation.

  • Posts: 634
  • Thank you received: 16
6 years 9 months ago #272865

Thanks for your clear and extensive clarifications.

Both answers ways sound very interesting, we will explore the "external images" first.

I guess this system reads the original images from an external site but then creats its own thumbnails on the real HikaShop site.

is this right?

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
6 years 9 months ago #272874

Hi,

No. As it is an external image, it directly display the img tag with the URL you entered in the src of the tag and add the width/height you want to it for the thumbnails so that they have the correct size.
Downloading the image to generate the thumbnails would defeat the purpose of having external URLs.

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum