Jump to content

[SOLVED] Is it possible to use external picture links?


Recommended Posts

Hi guys,

I have two suppliers for my shop.
for one I have the pictures on my site.

the other supplier offers me an external link for pictures.
because this supplier gives me over 15000 articles, I can imagine that my 200MB hosting will not to the trick for all those pictures :-)

Is there a possibility to use pictures linked to a special photo archive site of the supplier?

Or,
is it neccessary in prestashop to have 4 pictures for each product?
Can I say, I take the max 300 pixels pictures and use only them? also for the mini pictures in product list, etc...??

but I count out that one product takes over 150Kb par picture :
so for me = 15000*150= 2250000kb = 2.19 GB for pictures only :-(

any idea of this can be solved by adding the pictures in a different field? and then change code or something?

Link to comment
Share on other sites

Hello,

I wrote a small article about how to use Amazon S3 as a CDN with Prestashop.
If you can read french go here: Amazon&Prestashop;

It's not so simple, in any case you have to generate all images used by Prestashop.
One solution is to have a copy of your shop in your local PC/MAC and generate images using your local Prestashop...

all generated images will be located to the /prestashop/img/p directory.
You just have to full copy the imp/p directory to your CDN (content delivery network) and change the getImageLink function in the Link.php file like this :

public function getImageLink($name, $ids, $type = null) {
return « http://MYCDN/p/« .$ids.($type ? ‘-’.$type : »).’.jpg’;
}

Other thing to do is to update your Prestashop database on your server.

Not so simple...

Have a good day

Link to comment
Share on other sites

HI thanks,

but that's not an option.

because when you make your pictures by prestashop then you have picture names like 450-60.jpg
And the pictures I can use of my supplier are stored on : http://www.thisisanexample.com/pictures/productname.jpg

so ...... :-(

I think I must look for a large hosting partner :-) like you told me with amazon.

I was more thinking of not store any pictures in my hosting or 3th party hosting, but link the prestaproduct to the suppliershosting.
So I just store for a productname this : productname.jpg
and the image will be downloaded or shown directly from the suppliers directory...

but prestashop rename all pictures...so must indeed look for an other way.

Link to comment
Share on other sites

  • 2 weeks later...

in classes/link.php


public function getImageLink($name, $ids, $type = null)
{
return ($this->allow == 1) ?  ("http://www.myurl.be/".$ids.($type ? '-'.$type : '').'/'.$name.'.jpg') : ("http://www.myurl.be/img/p/".$ids.($type ? '-'.$type : '').'.jpg');
}


this work as long I do not use friendly URL

if I use friendly url then I had no pictures.
so I open the .htaccess and changed this :

RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E]
RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [L,E]



to

RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ http://www.myurl.be/img/p/$1-$2$3.jpg [L,E]
RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ http://www.myurl.be/img/p/$1-$2.jpg [L,E]



thanks for your help :-)

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...
×
×
  • Create New...