Jump to content

Problem with displaying images in my module. Help me!


Prostoshoper

Recommended Posts

When using the new storage system image link in my unit has the form
 
suit.com/img/p/274-5385-topseller.jpg
 
And the picture is not visible

Here is my code which displays its help to find the error
		foreach ($result as &$row)
		{
		 	$row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
		 	$row['id_image'] = Product::defineProductImage($row, $id_lang);
			if (sizeof($row['id_image']) > 0) {
				$image = new Image($row['id_image']);
				$row['image_url'] = _PS_BASE_URL_._THEME_PROD_DIR_.$row['id_image'].'-topseller.jpg';
	
			}
		}
		

		$html = '<div><div class="top-label"></div><a href="'.$result[0]['link'].'"><h3>'.$result[0]['name'].'</h3></a><a href="'.$result[0]['link'].'"></a><a href="'.$result[0]['link'].'"><img src="'.$result[0]['image_url'].'"></a><a href="'.$result[0]['link'].'"><span>'.Tools::displayPrice($result[0]['price']).'</span></a></div>';
		//<h5>'.$result[0]['category'].'</h5>
		
		
		return $html;
Link to comment
Share on other sites

Most image viewers do not provide any kind of automatic organization of pictures and therefore the burden remains on the user to create and maintain their folder structure (using tag- or folder-based methods). However, some image viewers also have features for organizing images, especially an image database, and hence can also be used as image organizers. Here is a guide for displaying image with an image viewer.

Edited by jerry1023 (see edit history)
Link to comment
Share on other sites

Most image viewers do not provide any kind of automatic organization of pictures and therefore the burden remains on the user to create and maintain their folder structure (using tag- or folder-based methods). However, some image viewers also have features for organizing images, especially an image database, and hence can also be used as image organizers. Here is a guide for displaying image with an image viewer.

It seems to me that you have not quite understood. I understand that I need to fix this line:

$row['image_url'] = _PS_BASE_URL_._THEME_PROD_DIR_.$row['id_image'].'-topseller.jpg';

But what???

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...