We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

plugin: Image Sizer

Development and Programming

outline4's avatar
outline4
271 posts
about 16 years ago
outline4's avatar outline4

hi there,

where is the directory of the cropped thumbnails situated again? I have a problem with directory rights… lucky for me the “base_cache” parameter exists 😉 I have the latest version 2.5.6

cheers stefan

@ryanisinallofus the plugin does crop! if you put width and height the same, the picture gets cropped. if you put specific heights and width at the same time the picture also get’s cropped. you might look into phpthumb for more functionallity. but imgsizer is much quicker and much user friendly… I love it and use it on every EE install!

       
ryanisinallofus's avatar
ryanisinallofus
6 posts
about 16 years ago
ryanisinallofus's avatar ryanisinallofus

so far when I do that it just gets smaller:

{exp:imgsizer:size src="{image}" width="75" height="75" alt="{title}" }
       
outline4's avatar
outline4
271 posts
about 16 years ago
outline4's avatar outline4
so far when I do that it just gets smaller:
{exp:imgsizer:size src="{image}" width="75" height="75" alt="{title}" }

if your picture was landscape it’ll now be a square by the size of 75px (so it was cropped in that sense). if your picture was square it’ll remain square and resized to 75px. if you’re looking for a function that cropps 75px out of the middle of a large picture and displays it, you’ll have to look into phpthumb… I guess imgsizr doesn’t do this… it always resizes and crops only if it has to…

cheers stefan

       
ryanisinallofus's avatar
ryanisinallofus
6 posts
15 years ago
ryanisinallofus's avatar ryanisinallofus

AAhhh too bad. Thanks though.

       
mpechicago's avatar
mpechicago
31 posts
15 years ago
mpechicago's avatar mpechicago

Hey I love the plugin, but I’m having problems currently… can’t seem to figure this one out:

I’m using the File extension to upload images, then I’m using ImgSizer to create thumbnails. If I use a full URL to the uploaded images, the thumbnail is created and displayed properly. When I use the custom field tag {image} instead, it doesn’t display.

Here is the template code:

{exp:weblog:category_heading weblog="grinders" relaxed_categories="yes" disable="category_fields"}
{exp:weblog:entries weblog="grinders" category="{category_id}" dynamic="off" orderby="title" disable="category_fields|trackbacks|pagination|member_data"}
{/exp:weblog:category_heading}


{if image!=""}

{exp:imgsizer:size src="{image}" width="40" alt="{title}"}{/exp:imgsizer:size}

{if:else}{site_url}/images/uploads/site/grinders/thumbs/na.png{/if}

In debug mode I get this:

(0.143430) imgsizer.img_full_path: C:/websites/mpechicagocom/html/{image} (0.143533) imgsizer.Error: C:/websites/mpechicagocom/html/{image} image is not readable or does not exist

It seems like it can’t read {image} properly as a URL. Which, according to File’s Documentation, it should feed a URL based on that tag. I have tried {image} outside of {exp:imgsizer:size} tag, and it works fine (displays a URL). Seems to only be broken in the one place I need it! 😉

Any help is appreciated.

       
Michael C. (KKCJ)'s avatar
Michael C. (KKCJ)
100 posts
15 years ago
Michael C. (KKCJ)'s avatar Michael C. (KKCJ)

Has anyone figured out how to prevent the plugin from sizing images to be larger than the source image?

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

@KKCJ

Using v2.5.6 as reference:

Line 152 and 153 (Size function) get the image width and height:

$img['src_width'] = $size[0];
$img['src_height'] = $size[1];

These are the original image sizes.

Line 373 & 374 (get_some_sizes function):

.... $TMPL->fetch_param('width'); 
.... $TMPL->fetch_param('height');

These are the sizes passed.

Looking at line 393 onwards (get_some_sizes function):

if (($width <= $max_width) && ($height <= $max_height) )
{
    $img['out_width'] = $width;
    $img['out_height'] = $height;
} else if (($x_ratio * $height) < $max_height) {
    $img['out_height'] = ceil($x_ratio * $height);
    $img['out_width'] = $max_width;
} else {
    $img['out_width'] = ceil($y_ratio * $width);
    $img['out_height'] = $max_height;
}

This would be a good place to add another if statement at the top.

Try this:

if ( ($img['src_width'] < $TMPL->fetch_param('width')) && ($img['src_height'] < $TMPL->fetch_param('height')) )
{
    $img['out_height'] = $img['src_height'];
    $img['out_width'] = $img['src_width'];
}
else if (($width <= $max_width) && ($height <= $max_height) )
{
...etc...

This is untested, so no guarantees! It will only leave your image at it’s current size if both the height and width are less than that specified.

       
lukemcr's avatar
lukemcr
154 posts
15 years ago
lukemcr's avatar lukemcr

I’m having the same basic problem as mpechicago two posts above.

I’m using imgsizer 2.5.6, and ever since we moved to a new server, I haven’t been able to get imgsizer to work in any way whatsoever. I’ve since started using PHPThumb, and that works fine, but I’d mich prefer to use imgsizer.

I’ve tried turning debug on, defining the base_path and base_cache, not using Mark Huot’s File extension in favor of a direct path to the file, and the suggestions of every imgsizer blank page post I could find on the EE forums. The imgsizer plugin tags either fail to render, or make the whole page blank.

Here’s the simplest example, not even getting in to imgsizer tag pairs or anything:

<h3>Hi!</h3>
{exp:imgsizer:size src="/home/myuser/public_html/DQM/images/news_uploads/image.jpg" width="200" alt="My Title" id="img_5334" class="entry_img"}

In the above example, the h3 “Hi!” renders, but the imgsizer plugin does not.

<h3>Hi!</h3>
{exp:imgsizer:size src="http://www.example.com/DQM/images/news_uploads/image.jpg" width="200" alt="My Title" id="img_5334" class="entry_img"}

In this example, I get a completely blank screen - the h3 doesn’t render, and viewing source shows no code.

Any ideas? For what it’s worth, the only difference between the former server and the new server is the web server: we used to run Apache, but the new server switched to Litespeed.

Edit: I’m running EE 1.6.7 and PHP Version 5.2.10. GD and ImageMagick are installed and compiled with PHP - they work just fine with PHPThumb.

       
cine_code's avatar
cine_code
14 posts
15 years ago
cine_code's avatar cine_code

Hi, I’m getting this error when trying to use image sizer:

Parse error: syntax error, unexpected '{' in /homepages/33/d291396367/htdocs/eefiles/plugins/pi.imgsizer.php on line 700

Running ee v 1.6.7 and image sizer 2.5.6 the line that creates the problem is:

{exp:imgsizer:size image="/images/uploads/6th-Av.jpg" width="100" height="100" alt=""}

Also, the plugin manager won’t load with image sizer installed.

Any ideas?

Aldo

       
LynneL's avatar
LynneL
239 posts
15 years ago
LynneL's avatar LynneL

Hope someone sees this and can help…am trying to use imgsizer with the nGen field in a FieldFrame Matrix (for what else? a gallery!).

Trying to do the thumbnails…

I can output the image in the Matrix loop, no problem. Introduce imgsizer to size the thumbs the way I want, no image shows up at all - no code is outputted.

{gal_img}
    <div class="gallerythumb">
        {exp:imgsizer:size src="{gal_img_up}" auto="156" alt="{gal_cap}"}
    </div>        
{/gal_img}

(Where gal_img_up is the image upload field, and gal_cap is the caption text field that goes with it.)

All I get is <div class=”gallerythumb”></div>, nothing between.

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

It might be a parsing issue, try putting the imgsizer call in an embed:

{gal_img}
    <div class="gallerythumb">
        {embed=includes/embedimage imageurl="{gal_img_up}" alttext="{gal_cap}"}
    </div>        
{/gal_img}

Obviously change “includes/embedimage” to be relevant to your template group and name

then in the additional template:

{exp:imgsizer:size src="{embed:imageurl}" auto="156" alt="{embed:alttext}"}
       
LynneL's avatar
LynneL
239 posts
15 years ago
LynneL's avatar LynneL

smacks head repeatedly

It just occurred to me it’s remotely possible this server does NOT have GD on it. This is the first time I’ve worked on this particular server. I’ve just sent an email in to our server guy to find out.

Usually this is never an issue because it’s so standard on most servers. This server is a little bit of a special case…

So of course the embed suggestion (nice suggestion BTW, don’t know why it didn’t occur to me, duh!) doesn’t work either, which is why the light suddenly dawned. Makes sense then that my previous try at the use of imgsizer in another part of the site was a bust…

Meh. Thanks for the suggestion, it at least led me in the right direction!

       
Macrike's avatar
Macrike
137 posts
15 years ago
Macrike's avatar Macrike

Any chance of changing the variables {width} and {height}, or something? When used together with Gallery Extended (from Solspace), those variables output the dimensions of the original image.

{exp:gallery_extended:entries gallery_name="news" limit="1" related_id="{entry_id}" type="weblog" dynamic="off" disable="member_fields|date_fields"}
    {exp:imgsizer:size src="{medium_url}" width="340" height="260"}
        <div class="image">
            {sized}
            {if caption}{caption}{/if}
        </div>
    {/exp:imgsizer:size}
{/exp:gallery_extended:entries}

Renders this:

<div class="image">
    /bla-bla/image_medium-340x260.jpg
    Bla,bla,bla...
</div>

Note that in imgsizer I specify 340x360 but it renders 430x280, the original dimensions of the image.

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

Try using the single tag instead of the tag pair

{exp:gallery_extended:entries gallery_name="news" limit="1" related_id="{entry_id}" type="weblog" dynamic="off" disable="member_fields|date_fields"}
        <div class="image">
            {exp:imgsizer:size src="{medium_url}" width="340" height="260" alt="{title}" }
            {if caption}{caption}{/if}
        </div>
{/exp:gallery_extended:entries}
       
LynneL's avatar
LynneL
239 posts
15 years ago
LynneL's avatar LynneL

Even worse news RE my problem…GD is installed.

Name : gd Arch : i386 Version: 2.0.33 Release: 9.4.el5_1.1

Sigh. Any more ideas?? Pretty please?

       
First 34 35 36 37 38 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.