Post by SimonHavelock » Tue Aug 28, 2012 9:07 pm

Hi!

Quick problem: how can I get link to the original file that was uploaded that is located in data folder not in cache/data?
<?php echo -?- ?>

Cheers!

Newbie

Posts

Joined
Wed Aug 15, 2012 3:19 am

Post by oc-extensions » Wed Aug 29, 2012 2:15 am

Hi,

Depends where you want to use:

example: if product page (controller) you can use:

Code: Select all

$image = HTTP_IMAGE . $product_info['image'];

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by SimonHavelock » Thu Aug 30, 2012 12:31 am

Thanks for your reply.
I need it for product.tpl, because changes I introduced in product.php only made it worse :)

How can I do that?

My problem is that I'm implementing zoom jquery plugin and I need 3 sizes for additional images (now there are two: thumb and popup). And I need original url for zoom image :)

Newbie

Posts

Joined
Wed Aug 15, 2012 3:19 am

Post by oc-extensions » Thu Aug 30, 2012 12:38 am

Hi,

in controller/catalog/product.php find

Code: Select all

if ($product_info['image']) {
				$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
			} else {
				$this->data['popup'] = '';
			}
and change to :

Code: Select all

if ($product_info['image']) {
   $this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
   $this->data['original_image'] = HTTP_IMAGE . $product_info['image'];            
			} else {
				$this->data['popup'] = '';
                                 $this->data['original_image'] ='';
			}

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by SimonHavelock » Thu Aug 30, 2012 1:38 am

Thanks! I'm getting closer :)

However now it's showing me original image of product not additional original image.

Code: Select all

if ($product_info['image']) {
				$max_width = (int)315;
				$max_height = (int)900;
                $oldsize = getimagesize(DIR_IMAGE.$product_info['image']);
                $scale = min($max_width/$oldsize[0], $max_height/$oldsize[1]);
                $new_width  = ceil($scale*$oldsize[0]);
                $new_height = ceil($scale*$oldsize[1]);
                 $this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $new_width , $new_height);
				 $this->data['original_image'] = HTTP_IMAGE . $product_info['image'];
			} else {
				$this->data['popup'] = '';
				$this->data['original_image'] ='';
			}
And I put this into my product.tpl file:

Code: Select all

<?php if ($images) { ?>
      <div class="image-additional">
        <?php foreach ($images as $image) { ?>
        <a href="<?php echo $original_image ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom', smallImage: '<?php echo $image['popup']; ?>' "><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
        <?php } ?>
      </div>
      <?php } ?>
It's possible that I need to change something here, but I have no idea what to add:

Code: Select all

foreach ($results as $result) {
				$this->data['images'][] = array(
					'popup' => $this->model_tool_image->resize($result['image'], $new_width_pop , $new_height_pop),
					'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))
				);

Newbie

Posts

Joined
Wed Aug 15, 2012 3:19 am

Post by oc-extensions » Fri Aug 31, 2012 12:08 am

Code: Select all

foreach ($results as $result) {
            $this->data['images'][] = array(
               'popup' => $this->model_tool_image->resize($result['image'], $new_width_pop , $new_height_pop),
               'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height')),
'original' => HTTP_IMAGE . $result['image']
            );

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by SimonHavelock » Fri Aug 31, 2012 1:43 am

Thanks! It works perfectly.

I had to change this fragment, though.

Code: Select all

<?php if ($images) { ?>
      <div class="image-additional">
        <?php foreach ($images as $image) { ?>
        <a href="<?php echo $image['original_image'] ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom', smallImage: '<?php echo $image['popup']; ?>' "><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
        <?php } ?>
      </div>
      <?php } ?>

Newbie

Posts

Joined
Wed Aug 15, 2012 3:19 am
Who is online

Users browsing this forum: No registered users and 79 guests