Image Tools extension

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Image Tools extension

Postby hansfn » Sun Aug 15, 2010 9:20 pm

This is the discussion topic for the Image Tools extension.

Visit http://extensions.pivotx.net/entry/30/imagetools for more info or download.
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Image Tools extension

Postby Reheuvel » Tue Sep 28, 2010 4:00 pm

Maybe it is a bug or by design Pivotx understands [[image:20100922_redwhiteblue.jpg]] for an entry but when Tinythumb parces it it shows as a file not found
Reheuvel
 
Posts: 22
Joined: Mon Aug 16, 2010 9:36 am

Re: Image Tools extension

Postby hansfn » Tue Sep 28, 2010 4:40 pm

Now you lost me:
1) What does this have to do with this extension? Is your point that findimages finds images that thumbnail is reporting as not found. (Timthumb, I assume that is what you meant, isn't parsing anything.
2) [[image:20100922_redwhiteblue.jpg]] is 100% wrong syntax in PivotX. It's the legacy syntax from Pivot that PivotX supports only to make it easier for people to upgrade from Pivot to PivotX. See image tag docs
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Image Tools extension

Postby Reheuvel » Tue Sep 28, 2010 8:07 pm

Sorry to make you confused, the code comes from an old pivot import and luckely the new pivotX still accepts the old way styling, timThumb (i thought it belonged to the imageTools extension) does not support the old code, i'll do some database replacement magic to make all old tags compliant with the new convention.
Reheuvel
 
Posts: 22
Joined: Mon Aug 16, 2010 9:36 am

Re: Image Tools extension

Postby winters » Thu Jan 13, 2011 9:15 pm

Hi I'am trying this with pivotx 2.2.2 mysql with no success. I would like to see
that when there is an image within the entry that the image is used and otherwise the word no image. can someone help me in the right direction?

[[ findimages var=imagelist source=$entry ]]

[[if $imagelist==""]]
no image
[[else]]
[[ thumbnail src=$imagelist.0 w=65 h=65 ]]
[[/if]]

thanks
willem
winters
 
Posts: 82
Joined: Thu Jan 13, 2011 9:09 pm

Re: Image Tools extension

Postby winters » Thu Jan 13, 2011 11:16 pm

sorry not that sharp from me

it should be

[[if $imagelist.0 ]]
[[ thumbnail src=$imagelist.0 w=65 h=65 ]]
[[else]]
no image
[[/if]]
winters
 
Posts: 82
Joined: Thu Jan 13, 2011 9:09 pm

Re: Image Tools extension

Postby hansfn » Fri Jan 14, 2011 12:21 am

And that worked, or?
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Image Tools extension

Postby winters » Fri Jan 14, 2011 12:44 am

sorry, that worked perfectly!
willem
winters
 
Posts: 82
Joined: Thu Jan 13, 2011 9:09 pm

Re: Image Tools extension

Postby xzjia » Fri May 13, 2011 6:57 pm

This extension is very useful, however there's one issue where I want to use the [[ thumbnail ]] to show a regular image, but resized on the server to fit my layout. This way I don't have to re-upload a higher resolution image any time the layout width changes, I also save bandwidth since the image has been scaled down before sent to the browser.

However, one problem, if you only specify the width of the image it works fine in resizing the image itself, but it outputs the "width='x'" attribute in the <img> tag, and no height attribute. Which means Internet Explorer (always this guy eh?) will display an image that's x wide, but only 1px high.

I'm really looking at this one as a bug, if only width or height has been specified, I don't think it should output the width/height code in the <img> tag itself and should just let the browse handle it.

Also as a suggestion, it might be great if you can use a variable for the width/height and when you change that variable in the extension setting all images using that variable will use the new width/height. Perfect if you got a bunch of images sized to the full width of your layout and then your layout changes.
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Re: Image Tools extension

Postby xzjia » Fri May 13, 2011 7:55 pm

I figured that I might as well try my hand at modding the extension myself, seeing that it shouldn't be that complicated.

I think... this works:

For hook_imagetools.php, Replace code block at line 84 with:

Code: Select all
    if ((!empty($params['w'])) && (!empty($params['h']))) {
    $img = sprintf("<img src=\"%s\" alt=\"%s\" width=\"%s\" height=\"%s\"%s />",
        $url,
        htmlentities($title, ENT_QUOTES),
        $params['w'],
        $params['h'],
        $class
    );
    } else {
    $img = sprintf("<img src=\"%s\" alt=\"%s\"%s />",
        $url,
        htmlentities($title, ENT_QUOTES),
        $class
    );
    }


I've also changed the default title/alt tag code so that the alt tag doesn't have a bunch of base64 encoded mess hanging on the page while the image loads, on line 75:
Code: Select all
$title = basename($params['src']);


Or go overboard like I did and strip extension, replace hyphen & underscore, and then capitalize the result:
Code: Select all
    if (empty($title)) {
       $info = pathinfo($params['src']);
       $glue = array('_', '-');
       $title = ucwords(str_replace($glue, ' ', basename($params['src'],'.'.$info['extension'])));
    }
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Next

Return to 2.x Extensions

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

cron