• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Solution - plugin maintaining original dimensions

Solution - plugin maintaining original dimensions 12 years 3 weeks ago #16977

  • sozo
  • sozo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hullo, just thought I'd share this in case anyone else was in a similar predicament. There's probably a better solution out there but this one suits my needs fine.

Some of my original images were portrait and some landscape, but the generated thumbnails and full-size images were locked to a 4:3 (landscape) ratio, so the top and bottom were being cropped off the portraits when using the content plugin.

So I set it to ignore the generated thumbnail/full and just use the original.

plugins/content/rsmediagallery.php

After:
foreach ($items as $item)
	{
	$small_image = RSMediaGalleryHelper::getImage($item, $params->get('thumb_width', $this->params->get('thumb_width', 280)), $params->get('thumb_height', $this->params->get('thumb_height', 210)), true);
	$big_image   = RSMediaGalleryHelper::getImage($item, $params->get('full_width', $this->params->get('full_width', 800)), $params->get('full_height', $this->params->get('full_height', 600)), true);

Add:
$tagOne = "gallery/";
	$tagTwo = "/";
 
	$startTagPos = strrpos($small_image, $tagOne);
	$endTagPos = strrpos($small_image, $tagTwo);
	$tagLength = $endTagPos - $startTagPos + 1;
 
	$original_image = substr_replace($small_image, 'gallery/original/', $startTagPos, $tagLength);

Find:
$html .= '<a href="'.$big_image.'" rel="gallery" class="pirobox_gall'.$index.'"'.$title.'><img src="'.$small_image.'" alt="'.$this->escape($item->title).'" /></a>';

Change to:
$html .= '<a href="'.$original_image.'" rel="gallery" class="pirobox_gall'.$index.'"'.$title.'><img src="'.$original_image.'" alt="'.$this->escape($item->title).'" width="210" /></a>';



Hope that helps someone.
Last Edit: 12 years 3 weeks ago by sozo.
The administrator has disabled public write access.

Re: Solution - plugin maintaining original dimensions 12 years 3 weeks ago #17007

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
Hello,

This is probably not a good idea because you'll end up with images being "squashed" (distorted). Because people have images with different sizes and aspect ratios we've added the thumbnail cropping option to overcome this - you can set the portion of the image you'd like to show and all your images will appear correctly.

Regards!
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re: Solution - plugin maintaining original dimensions 12 years 2 weeks ago #17102

  • tassie
  • tassie's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi Octavian

I have the same problem with wanting to show portrait pictures not landscape and I have found that the problem seems to be that the gallery defaults to the width extent, cropping the top and bottom of my pictures. It doesnt really help that in the backend you can 'crop the picture to the portion that you want to show', because its still crops the top and bottom of what is essentially a portrait oriented picture to landscape. Surely what is required is the ability to 'zoom to the extent' of the pic with an adjustable aspect ratio?

See my link www.goodsport.org.za/index.php?option=co...diagallery&Itemid=12 example u_blessing.jpg

regards

Tassie
The administrator has disabled public write access.

Re: Solution - plugin maintaining original dimensions 12 years 3 days ago #17216

I have tried this solution and it works great... until I upload a new image. Then the component don't put the new image in the directory /original. And the image don't show up in my gallery.

The image link says:
<img src="http://www.mydomain.com/components/com_rsmediagallery/assets/gallery/original/jpg" alt="newimage.jpg" width="120">
There's no filename...

Do you know what's wrong?
The administrator has disabled public write access.

Re: Solution - plugin maintaining original dimensions 12 years 2 days ago #17221

I solved the problem I had! Use this code if you want to be able to upload new images as well. It works like a charm for me anyways.

line 189-212 in plugins/content/rsmediagallery.php:
{
$small_image = RSMediaGalleryHelper::getImage($item, $item->filename, true);
$big_image   = RSMediaGalleryHelper::getImage($item, $item->filename, true);
$tagOne = "http://yourdomain.com/components/com_rsmediagallery/assets/gallery/";
$tagTwo = "/";
 
$startTagPos = strrpos($big_image, $tagOne);
$endTagPos = strrpos($big_image, $tagTwo);
$tagLength = $endTagPos - $startTagPos + 1;
 
$original_image = substr_replace($big_image, 'http://yourdomain.com/components/com_rsmediagallery/assets/gallery/original/', $startTagPos, $tagLength);
$title = $show_title ? ' title="'.$this->escape($item->title).'"' : '';
 
$html .= '<li>';
$html .= '<div class="rsmg_content_container" style="width:120px;">';
$html .= '<a href="'.$original_image.'" rel="gallery" class="pirobox_gall'.$index.'"'.$title.'><img src="'.$original_image.'" alt="'.$this->escape($item->title).'" width="120" /></a>';
 
/* Image title and description */
$html .= '<p><strong>'.$this->escape($item->title).'</strong><br />';
$html .= ''.$this->escape($item->description).'</p>';
 
$html .= '</div>';
$html .= '</li>';
}

I added the title and description of the image too. You can remove those lines if you don't want to show that.
Change yourdomain.com to your sites domain name.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!