Announcement: New plug-in SuperSizer
Re: Announcement: New plug-in SuperSizer
Thanks Jeremy - I see - I just thought this is what the Fit parameter was going to do.
I seem to be learning a lot from you these days. I'd love to know a bit more about best practice in cmsms and why some things make a difference.
I noticed that callguy mentioned not using too many GCBs, but I don't know why (Im sure he's right). My templates are full of them, as it is the only way I can manage multiple templates containing similar content, without having to make single changes many times - as this is liable to generate mistakes.
Another example - creating a UDT that makes a db query to create an array rather than using a potentially very long winded piece of smarty scripting. Why is one better than the other? The db query could be much simpler to achieve. Is it something to do with the caching?
You dont have to answer these questions - i'm just putting the pieces of the jigsaw together slowly.
Kind regards
Nik
I seem to be learning a lot from you these days. I'd love to know a bit more about best practice in cmsms and why some things make a difference.
I noticed that callguy mentioned not using too many GCBs, but I don't know why (Im sure he's right). My templates are full of them, as it is the only way I can manage multiple templates containing similar content, without having to make single changes many times - as this is liable to generate mistakes.
Another example - creating a UDT that makes a db query to create an array rather than using a potentially very long winded piece of smarty scripting. Why is one better than the other? The db query could be much simpler to achieve. Is it something to do with the caching?
You dont have to answer these questions - i'm just putting the pieces of the jigsaw together slowly.
Kind regards
Nik
Re: Announcement: New plug-in SuperSizer
>>callguy mentioned not using too many GCBs,
yes mostly for db call as you have to pull that script and it adds time to the process.. same thing with a udt, you will be making a db call before you even had the script to process.. I just prefer not use UDTs unless I have to..
>>I just thought this is what the Fit parameter was going to do.
My interpretation of fit is edge to edge.. so it's fit to width or fit to height and as such is how I wrote it..
I would think what I put below should fit your needs thuo you will want to tune it.. but the idea is to normalize, so for starters you can use supersizer to permanently do a first size on upload, and then this little logic..
I just suggest that you play
hope this helps.. Cheers -Jeremy
yes mostly for db call as you have to pull that script and it adds time to the process.. same thing with a udt, you will be making a db call before you even had the script to process.. I just prefer not use UDTs unless I have to..
>>I just thought this is what the Fit parameter was going to do.
My interpretation of fit is edge to edge.. so it's fit to width or fit to height and as such is how I wrote it..
I would think what I put below should fit your needs thuo you will want to tune it.. but the idea is to normalize, so for starters you can use supersizer to permanently do a first size on upload, and then this little logic..
I just suggest that you play

Re: Announcement: New plug-in SuperSizer
I had the same issue and did this:
1. Write a UDT that checks image width vs height against preferred ratio:
2. Adapt the supersizer call based on the result:
1. Write a UDT that checks image width vs height against preferred ratio:
Code: Select all
// UDT isportrait
// params image= filepath to image
// if heigth > width returns true
if ( isset($params['image']) ) {
global $gCms;
if( !isset($gCms) ) exit;
$smarty =& $gCms->GetSmarty();
$config =& $gCms->GetConfig();
$parts = explode ( ".com/" , $params['image'] );
$filepath = $config['root_url'].'/'.$parts[1];
$imageinfo = getimagesize($filepath);
// Idea width / height ratio is 1.5658
$portait = false;
if ( ($imageinfo[0] / $imageinfo[1]) <= 1.5658 ) {
$portrait = true;
}
$smarty->assign('isportrait' , $portrait);
// If image is small nozoom
$nozoom = false;
if ( ($imageinfo[0] <= 220) || ($imageinfo[1] <= 200 ) ) $nozoom = true;
$smarty->assign('nozoom' , $nozoom );
}
Code: Select all
{capture assign='imagepath'}{$entry->file_location}/{$image1}{/capture}
{isportrait image=$imagepath}
{if $isportrait}
{supersizer path=$imagepath height=129 passthru=true alt=$entry->product_name|escape:htmlall strip_tags=true error=false}
{else}
{supersizer path=$imagepath width=202 passthru=true alt=$entry->product_name|escape:htmlall strip_tags=true error=false}
{/if}
Re: Announcement: New plug-in SuperSizer
NikNak, I don't know if I have this exacly right (didnt test it), but I think you are looking for something like this?
Code: Select all
{assign var=pathIS value="uploads/imgpath/name.jpg"}
{assign var=sizeIS value=$pathIS|getimagesize}
{if $sizeIS[0]>$sizeIS[1]}{*width > height*}
{supersizer path=$pathIS height='120' width='90' crop="center,top,`120/$sizeIS[1]*100`"}
{else}
{supersizer path=$pathIS height='120' width='90' crop="center,top,`90/$sizeIS[0]*100`"}
{/if}
Re: Announcement: New plug-in SuperSizer

Re: Announcement: New plug-in SuperSizer
Thanks very much guys for the examples.
I have one issue remaining now, as all I want (and have ever really wanted) is to centrally crop an image to fit a space completely. This latest version appears to be adding extra image area rather than cropping.
I am now seeing black stripes at the top and bottom of a cropped image, where supersizer has fitted the image inside the required space and padded out the remainder with black. Can I get this to just crop to fit?
Kind regards
Nik
I have one issue remaining now, as all I want (and have ever really wanted) is to centrally crop an image to fit a space completely. This latest version appears to be adding extra image area rather than cropping.
I am now seeing black stripes at the top and bottom of a cropped image, where supersizer has fitted the image inside the required space and padded out the remainder with black. Can I get this to just crop to fit?
Kind regards
Nik
Re: Announcement: New plug-in SuperSizer
NikNak, which code do you use now? Is it a 1 pixel black stripe? that could be a rounding issue.
Re: Announcement: New plug-in SuperSizer
Hi Jos
No it was variable from 2 to 10 or more pixels in my examples.
{supersizer path=whatever width=190 height=95 url='true' crop='true' protect='false' assign='thumbpic'}
Thanks
Nik
No it was variable from 2 to 10 or more pixels in my examples.
{supersizer path=whatever width=190 height=95 url='true' crop='true' protect='false' assign='thumbpic'}
Thanks
Nik
Re: Announcement: New plug-in SuperSizer
do me a fav and pass over the images as they are be for they are sized.. I will try something.. but I want to make sure it works there.. that should be working and I don't know why it is not.. I have tested tight long crops like your wanting to do.. so .. hmm, yeah please pass your images so I can recreate the issue... tk -J
Re: Announcement: New plug-in SuperSizer
ok.. here is it.. all fixed and should be ready now to release..
@NikNak please test but here is my test on your images..
http://www.corbensproducts.com/blog/exp ... ikNakcrop4
Please let me know.. cheers -Jeremy
PS.. I'm headed home so I will not be able to get back for a bit..
@NikNak please test but here is my test on your images..
http://www.corbensproducts.com/blog/exp ... ikNakcrop4
Please let me know.. cheers -Jeremy
PS.. I'm headed home so I will not be able to get back for a bit..
- Attachments
-
[The extension txt has been deactivated and can no longer be displayed.]
Re: Announcement: New plug-in SuperSizer
Hi Jeremy - that seems to have done the trick.
Thank you again.
Nik
Thank you again.
Nik
Re: Announcement: New plug-in SuperSizer
Ok,
the new release is out..
http://dev.cmsmadesimple.org/project/files/752
Note if your updating from a release from before (not the last few posts on here) you should double check your params again.
Enjoy and hope you all like it. Cheers -Jeremy

http://dev.cmsmadesimple.org/project/files/752
Note if your updating from a release from before (not the last few posts on here) you should double check your params again.
Enjoy and hope you all like it. Cheers -Jeremy
Re: Announcement: New plug-in SuperSizer
i am using the last supersizer version with CMSms 1.6.7 and availbility module 1.7.11.
i call a custom field (type=image) like this:
which works pretty good. but now i want to thumbnail it with supersizer, therefore i tried it this way:
and
.
but both methods do not work. i get following error message from supersizer:
what is wrong??
i call a custom field (type=image) like this:
Code: Select all
<img src="{$file_location}/{$rsrc.fields.myimage.value}" alt="{$rsrc.name}" />
Code: Select all
{assign var=imagethumb value=`$file_location`/`$rsrc.fields.myimage.value`}
{supersizer path=$imagethumb width="100"}
Code: Select all
{capture assign=imagethumb}{$file_location}/{$rsrc.fields.myimage.value}{/capture}
but both methods do not work. i get following error message from supersizer:
Code: Select all
There is a path issue with the orginal image!
Does this look right?
Path:/home/www/myurl.myhost.org/htdocs/yurl.myhost.org/uploads/Availability/resources_1/thumb_346.jpg
Re: Announcement: New plug-in SuperSizer
I take it that you real path is..
/home/www/myurl.myhost.org/htdocs/uploads/Availability/resources_1/thumb_346.jpg
ie: yank out yurl.myhost.org/?
what does {$file_location} output?
/home/www/myurl.myhost.org/htdocs/uploads/Availability/resources_1/thumb_346.jpg
ie: yank out yurl.myhost.org/?
what does {$file_location} output?
Re: Announcement: New plug-in SuperSizer
http://myurl.myhost.org/uploads/Availab ... esources_1JeremyBASS wrote: what does {$file_location} output?
and $rsrc.fields.myimage.value outputs filename.jpg
maybe it does not work with subdomains?