30 lines
872 B
PHP
30 lines
872 B
PHP
<?php
|
|
|
|
namespace App\Classes;
|
|
|
|
use ApiLink;
|
|
|
|
trait ImageTrait {
|
|
|
|
public function getProductImage($id_image, $link_rewrite, $type = 'home') {
|
|
$img = (new ApiLink())->getImageLink($link_rewrite, $id_image, $type);
|
|
return str_replace($_SERVER['SERVER_NAME'], env('DOMAIN_STATIC'), $img);
|
|
}
|
|
|
|
/**
|
|
* Get Image for a given sale
|
|
*
|
|
* @param $id_sale integer The id sales
|
|
* @param $active boolean Whether to return inactive image of the sale
|
|
*
|
|
* @return string url to the sale image
|
|
*/
|
|
public function getSaleImage($id_sale, $active = true) {
|
|
global $cookie;
|
|
|
|
$extension = $active === true ? 'liston' : 'listoff';
|
|
return env('DOMAIN_STATIC') .
|
|
__PS_BASE_URI__.'modules/privatesales/img/' . $id_sale . '/' .
|
|
$extension . '_' . $cookie->id_lang . '.jpg';
|
|
}
|
|
} |