Announcement: New plug-in SuperSizer

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
kendo451

Re: Announcement: New plug-in SuperSizer

Post by kendo451 »

I'm using this tag here, but either I used it wrong, or there's a bug:

http://livingoffshore.com  see the book list on the right sidebar - each book cover is SuperSized.

Problem is the url for the image has an extra / inserted like this:
http://ul.livingoffshore.com/SuperSizer ... 5-p0-F.jpg

Here's the tag call (from a Products summary template):

Code: Select all

{capture assign='imagepath'}{$entry->file_location}/{$prod_thumb}{/capture}
 {supersizer path=$imagepath height='125' alt="" rootUrl="http://ul.livingoffshore.com"}
It produces this result:

Code: Select all

<img alt="" src="http://ul.livingoffshore.com/SuperSizerTmp//one_nation.-w0-h125-p0-F.jpg" />
Notice the extra slash after SuperSizerTmp.  Is that caused by me, or is there a bug?

Ken
JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

Yeah it's a minor bug, but it has been fixed in the svn.  Since it's not stoping it from working, I have not published in lue of working on the filter combinations (for sepia outputs etc) and the cropIt features... I'm expecting to release the next version in a week or so.. Thanks for the heads up...

Cheers
Jeremy
smansman
Forum Members
Forum Members
Posts: 28
Joined: Wed Apr 23, 2008 6:08 pm

Re: Announcement: New plug-in SuperSizer

Post by smansman »

JeremyBASS is it ok if I make some changes and send them to you

what I was thinking to change is add an extra flag to be able to use basedir as a free path let me explain

now I achieve the same through this (used on news module):
{capture assign="imga"}{$entry->file_location}/{$entry->image}{/capture}
{capture assign="imgloc"}news/id{$entry->id}{/capture}
{supersizer path="$imga" width="120" height="80"  Prefix="thumb" Protect=true  Subdir="../$imgloc"}

you see i jump one dir back through ../ in Subdir

so I was thinking to do some minor changes on the function (send them to you) and that way someone could use it like this:

{supersizer path="$imga" width="120" height="80"  Prefix="thumb" Protect=true  Subdir="the/dir/I/want/to/save" skipfixedSubdir=true}
extraparameter --> skipfixedSubdir=true or something named like that
that way the code will not go from the base dir but from upload through
$config['uploads_path']."/here the variable as set on Subdir

actually skiping the /SuperSizerTmp/ dir :)

IF you agree :)

oh and one question is there a way NOT to put all this "-w".$width."-h".$height."-p".$percentage."-F".$filter
else I could also implement an extra flag to skip them too

Thank you for your time

OH by the way GREAT function you did :)
JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

Well you can send it but for the "//" that is taken care of.  I think I could make an option for the "-w" "-f" stuff... See, I want it as at a glance I can tell what it is and where it came from...

on "actually skiping the /SuperSizerTmp/ dir", sorry that will not happen in this plugin form.. I think as I start the module enhancement I can make that so I guess...

There is more coming... once the corpIt and filter combo is added I'll publish again, then shortly after I'll be on the mod enhancement... Cheers -Jeremy
smansman
Forum Members
Forum Members
Posts: 28
Joined: Wed Apr 23, 2008 6:08 pm

Re: Announcement: New plug-in SuperSizer

Post by smansman »

JeremyBASS wrote: Well you can send it but for the "//" that is taken care of.  I think I could make an option for the "-w" "-f" stuff... See, I want it as at a glance I can tell what it is and where it came from...
sorry I probably was not clear enough
I never meant anything regarding // issue the whole idea was to be able to skip putting images (for caching purposes)
to /SuperSizerTmp/ and use any Dir I want under the $config['uploads_path'] like $config['uploads_path']/anyDirIwant
and this because if you put small cached images under $config['uploads_path']/news/idofarticle/ if you delete the article the cached image is also deleted :) so not leaving any trush :)
JeremyBASS wrote: on "actually skiping the /SuperSizerTmp/ dir", sorry that will not happen in this plugin form.. I think as I start the module enhancement I can make that so I guess...
sorry my English is not so advanced i did not understood what you mean here so is it ok to make this change and send it to you or you dont what this as a future for this module?
JeremyBASS wrote: I think I could make an option for the "-w" "-f" stuff... See, I want it as at a glance I can tell what it is and where it came from...
So its ok for u if i make a extraswitch and send you the code?
JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

ok.. I get ya.. sure.. I'll work it in... as far as "So its ok for u if i make a extraswitch and send you the code?".. no need I'll add it in... I am going to be publishing it all soon... cheers
Jeremy
smansman
Forum Members
Forum Members
Posts: 28
Joined: Wed Apr 23, 2008 6:08 pm

Re: Announcement: New plug-in SuperSizer

Post by smansman »

as promised here is the file
I tried to change as lilte as possible on your code thats why I have the 2 ifs etc it could be done nicer but i had to change a lot of your code and didn't want to touch your road map :)

i had put some comments where i changed what so its easy for you to find also i found a bug in the
$OlDextension = substr($path, (strrpos($path,".")+1));//removed the +1 because of a bug
it was forcing $filebasename = basename($path, $OlDextension);
to always return filename. instead of filename (the dot)

i added lines
297-298

changed
312 (old code is between 313-315)

added comment on 326

added extra code from 336 to 362
pay attention on line
337 $SuperSizerDir="/SuperSizerTmp/";//use one variable for it so we can change it globally

changed 364,365
changed 378,379
at 379 was not sure if we want to unlink the basedir if subdirswitch was set so i left it for the supersizedir I didn't want to mesh with your road map although i suppose it should be set to basedir if subdirswitch is set 


changed 382,383

and added extra debug info at 400-409


I did changes only in function smarty_cms_function_supersizer($params, &$smarty)

so didn't touch this
$dirpath=$config['uploads_path']."/SuperSizerTmp/";
!!!! although we should change this also
in function smarty_cms_help_function_supersizer()

that's it hope it helped and it follows your road map
thanks
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

[The extension txt has been deactivated and can no longer be displayed.]

JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

I'm about to release a new version.. it's jam packed fill of nice little details as well fixes for good the space issues and "//" stuff... Anyone that was saying they had issues please if you can re-test with this and I bet it's good to go now.

So what new:
Params

removeUniqueness (optional) Default:false Highly discouraged Remove uniqueness of the created file, or in other words keep the old name ( true/false )

crop (optional) Default:false A must if you set height and width or use a percentage This will center the image and crop from edge in.  Don't like that? Use the X and Y arguments to offset, but the pxs are in relation to the original size image, if you need to make that dynamic use smarty magic.  Example: to move to the left of center crop="true,-50, 0" (  "true,X,Y"/"false"  )

NEW filter

IMAGEHUE -  This is different from COLORIZE, it's much more like Photoshop's hue function. Use farg1 , farg2 and farg3 respectively as red , blue , green. The range for each color is 0 to 255.  see the diff here http://www.digitalbarn.tv/index.php?page=testpage the Space Test is the IMAGEHUE and the ones above are COLORIZE.. Same numbers ... big diff right :D

More descriptive Errors

AND!!!! use filters together....

here is how
{supersizer path=$File height="200"  width="200" crop=true filter="SMOOTH,GRAYSCALE,COLORIZE" farg1="50,,60" farg2=",,45" farg3=",,10" farg4=",,0"}<<< HOW TO DO sepia

•Fixed the space issues and getting error with getimagesize() not finding the file talked about lower in this post and the fact that I was alerted today that one could use the path... that over sight is corrected.  - If you used the image's server path as a fix , that has been removed.  Use path="uploads/…/image.jpg"  or path="http://domain.com/uploads/…/image.jpg

•Fixed the issue with "//" if a subdomain

The only other request was to change the SuperSizerTmp folder… I thought about it and it’s best to use UDT’s.  Write a UDT to target the sub folder in the SuperSizerTmp folder for deletion and attach the udt to the event … so you could delete the folder on the deletion of a FEU user or a news article… look to the udt I point out below on how to use…

Read the help for more information… Get creative… SuperSize it!!!

Cheers
Jeremy

   
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by JeremyBASS on Wed Dec 23, 2009 5:09 am, edited 1 time in total.
JeremyBASS

SuperSizer (Delete SuperSizer created Images on News Article Deletion)

Post by JeremyBASS »

Delete SuperSizer created Images on News Article Deletion
So @smansman your need for the change in moving the root of the cached area was so that the images would be cleared on deletion of the article... Thou I have decided not to do the variable cache folder name, this is how to achieve what you’re asking, and will work on other things like FEU user deletion etc providing more flexibility then allowing the moving of the cached folder... I use this plugin a lot and I also needed to delete the images on the news articles... So this is what I did...

The tag...
{capture assign=imgIs}{$entry->file_location}/{$field->value}{/capture}
{supersizer path=$imgIs height="303"  width="456" crop='true' Quality=80 Subdir=$entry->id alt="Place caption field value here"}

So Make a UDT (deleteNewsArtclePics):

Code: Select all


global $gCms;
include 'plugins/function.supersizer.php';

$config =& $gCms->GetConfig();
$dirpath=$config['uploads_path']."/SuperSizerTmp/".$params['news_id']."/";
function recursive_rmdir($dir)
	 {
		// all subdirectories and contents:
		if(is_dir($dir)){
			$dir_handle=opendir($dir);
		}else{
			return false;
		}
		while($file=readdir($dir_handle))
		{
		if($file!="." && $file!="..")
		{
		if(!is_dir($dir."/".$file))unlink ($dir."/".$file);
		else $this->recursive_rmdir($dir."/".$file);
		}
		}
		closedir($dir_handle);
		rmdir($dir);
		return true;
	}

echo "$dirpath <br/>If you see this, that is an error";
recursive_rmdir($dirpath);





Add it to the event.  In this case

Module Name:News
Event Name:NewsArticleDeleted
UDT added:deleteNewsArtclePics

Sent when an article is deleted the folder is too.

Note: the tag has Subdir=$entry->id but you would want Subdir="news/$id" or Subdir="feuUser/$id" if you had more then one mod using supersizer...

Test it out.. Do this on a test server first.

Hope this helps,
Cheers
Jeremy

*tested on lastest version
fredp
Forum Members
Forum Members
Posts: 218
Joined: Sun Jul 27, 2008 1:36 am
Location: USA

Re: Announcement: New plug-in SuperSizer

Post by fredp »

JeremyBASS wrote: I'm about to release a new version.. ... if you can re-test with this... .
...
Hi Jeremy,

I just tried your latest version of SuperSizer (http://forum.cmsmadesimple.org/index.ph ... #msg189944). 

I'm not using any new features, but no regressions were noticed from the last version I tested on 2009-12-04.   

Hope this helps,
Fred P.
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

Super thank you for getting back... should be I would only need darconny to try it and then I'd have everyone that had reported issues confirmed solved.

Thank you,
Cheers
Jeremy
User avatar
moonie
Forum Members
Forum Members
Posts: 81
Joined: Tue Feb 13, 2007 3:08 pm
Location: Switzerland

Re: Announcement: New plug-in SuperSizer

Post by moonie »

This is an excellent plugin, very useful! I use it to create little preview thumbs for news summaries using a field definition file upload.

I then used to call this image with id}/{$entry->newsimage}" alt="" /> for the news detail. But now the client uploaded a giant image, which made me put the supersizer in the detail template as well:

Code: Select all

{assign var=newsid value=$entry->id}
{assign var=newsimg value=$entry->newsimage}
{supersizer path="uploads/news/id$newsid/$newsimg" width='400'}
This works great, but I have one little problem. Images that are smaller than 400px are not displayed that way, and I don't want them to be sized up with the 'Protect' parameter (there are a some small 50-100px images in there too, and it looks too weird to size them up to 400).

How would I put the code so it only triggers for images larger than 400px, and else just displays the original one without resizing at all? I'm a bit lost right now  :-[

Thanks alot for your help!
JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

Hi there moonie, this is no sweat.  This is based off a post deep in here...
EXAMPLE:
$widthIS[1] - height
$widthIS[0] - width

{assign var=widthIS value=$image->file|getimagesize}
{if $widthIS[0]>'400'}
{supersizer path=$image->file alt="" height='700' Quality='100' cacheBuster=true  Subdir=$entry->id Assign="Major" URL=ture}
{/if}


Hope this helps... Cheers
Jeremy
User avatar
moonie
Forum Members
Forum Members
Posts: 81
Joined: Tue Feb 13, 2007 3:08 pm
Location: Switzerland

Re: Announcement: New plug-in SuperSizer

Post by moonie »

Thanks for your help Jeremy.

I somehow can't get the $image->file|getimagesize part to work correctly with my News template.

I tried to replace $image->file with every possible variation (calling ith with my var $newsimg, with $entry_newsimage, by adding the whole path with ID and everything etc.), but I haven't found a working way that actually grab the image size.

For example trying to grab the imagesize for my var $newsimg gives me a:
Warning: getimagesize(picturename.jpg) [function.getimagesize.php]: failed to open stream: No such file or directory in...

I must be doing something completely wrong, but can't figure it out.
JeremyBASS

Re: Announcement: New plug-in SuperSizer

Post by JeremyBASS »

Hmm.. To test where the issue lays I'd make the call to get the width hardcoded... Like

{assign var=widthIS value="file/path/to/image/uploads/news/id/image.jpg"|getimagesize}

That should work as getimagesize() is a gd function and if you can use the plugin you can get the size... also I just realized I never released the last version, I only posted it below for review... Which version do you have?

Cheers
Jeremy
Locked

Return to “Modules/Add-Ons”