Override Picture Service

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 7 ans
Hi everyone

We have a massive store, 20+ million products. The images are all stored on Azure, a single point of reference for all our products.

NOP doesn't seem to allow for web based product images. Is there a way we can override the current PictureService methods to retrieve the Azure based URL if it exists?

The other option is to create a custom theme and a web helper to write the Image URL and then the images from the picture service...don't really want to follow this route if it can be avoided.

Please advise.

Thank you very much.

Kind Regards
Il y a 7 ans
[email protected] wrote:
Hi everyone

We have a massive store, 20+ million products. The images are all stored on Azure, a single point of reference for all our products.

NOP doesn't seem to allow for web based product images. Is there a way we can override the current PictureService methods to retrieve the Azure based URL if it exists?

The other option is to create a custom theme and a web helper to write the Image URL and then the images from the picture service...don't really want to follow this route if it can be avoided.

Please advise.

Thank you very much.

Kind Regards


Yes. you can override current PictureService using plugin. You can contact with me.
Il y a 6 ans
Sorry for resurrecting a year old thread.

I am facing the same challenge.
So, did you manage to override IPictureService ? Any thoughts on that ? Maybe an all-purpose plugin for web urls?

To Nop stuff ; Would such a feature be desired? If I develop it, should I push to github ? If so, are there any compatibility problems I keep in mind ?

Thanks in advance,
Kostas Alexopoulos
Il y a 6 ans
If you haven't yet, check out AzurePictureService, which also overrides methods in PictureService.

https://github.com/nopSolutions/nopCommerce/blob/651e0fc0648da34239544c47b1a6642df7f3dc51/src/Libraries/Nop.Services/Media/AzurePictureService.cs

Hope that helps!
Il y a 6 ans
Thanks for the quick reply.

I just finished extending PictureService to adapt our business logic.

My first implementation inlcudes WebPicture a class derived from Picture and MyPictureService which extends PictureService.
Then override
1) GetPicturesByProductId so that it returns type WebPicture
2) GetPictureUrl which constructs urls based on WebPicture.

The problem with this approach is that it is only useful for products (even though they are my sole concern).

I would suggest an all purpose approach that includes creating 3 derived types of Picture

1) FilePicture -> a picture stored in local filesystem
2) DbPicture -> a picture stored in database
3) WebPicture -> a picture accessed via a remote url

Then have a common method
String GetUrl(...) 

and each type will provide an imlementation.

1) local file
2) controller action
3) remote url

This would require a new table in the database for each picture type and use Picture as a mapping to each one.

Even though, this approach does not comply with the POCO pattern nopCommerce seems to use for domain objects, I believe it is far more versatile.

Any thoughts on that ?
My current solution gets the work done, so I will proceed with the second proposal only if there is a possibility it will accepted to the repository.

Ps If I am posting in the wrong place, please direct me.

Thanks in advance,
Kostas Alexopoulos
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.