Jump to content

Supplier Images not displaying on Back office


Recommended Posts

I have a custom controller which is able to create a new supplier. I use the following code to create the supplier with the images:

$supplier = new Supplier();
$supplier->name = $vendorapp->company_name;
$supplier->description = $vendorapp->description;
$supplier->active = true;
$supplierid = $supplier->save();
if(isset($vendorapp->file_name) && file_exists(_PS_MODULE_DIR_.'../upload/'.$vendorapp->file_name))
	rename(_PS_MODULE_DIR_.'../upload/'.$vendorapp->file_name, _PS_SUPP_IMG_DIR_.$vendorapp->file_name);
	$images_types = ImageType::getImagesTypes('suppliers');
	foreach ($images_types as $k => $image_type)
		$file = _PS_SUPP_IMG_DIR_.$vendorapp->file_name;
		ImageManager::resize($file, _PS_SUPP_IMG_DIR_.$supplier->id.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height']);

The images generate perfectly in the /img/su folder and are named [supplier_id]-[image_type].jpg for example 15-large_default.jpg


On the supplier block, I can view the image perfectly. But on the back office, Catalog -> Suppliers - There is no image displaying.


Any idea why or how to solve?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...