Image Size

Feb 15, 2010 at 10:31 AM
Edited Feb 15, 2010 at 10:32 AM

Hi,

Thanks for the tool , it works great.

I would like to know how to forc e the width and height of an image when displaying it in a list.

In the code i found  resizer(), but it is to display a miniature when editing or creating an item.

If i add the picture to an image library i can edit it in microsoft office picture manager.*

I'd like to resize the image within the code.

 

Thx for help.

 

 

Coordinator
Feb 15, 2010 at 3:35 PM

Hello,

do you want a different size for each picture ? Actually I had hard coded these values in the fldtypes_*.xml file. It's in the Display Pattern. You can easily change it in this file but if you want to choose the dimension of each image in the list view, it will require more custom developpement.

Regards

Feb 16, 2010 at 12:00 PM

hello,

i want the same size for every image. I'm looking right now how to change the xml file.

If you have time, please feel free to tell me where to change the atributes width and height. Maybe ill be still looking.

Thank you for your fast response.

Regards

Coordinator
Feb 16, 2010 at 12:06 PM

Hi,

in the fldtypes_ImageField.xml, you have this :

<RenderPattern Name="DisplayPattern">
      <Switch>
        <Expr>
          <Column />
        </Expr>
        <Case Value=""></Case>
        <Default>
          <HTML>
            <![CDATA[<a href="]]>
          </HTML>
          <Column />
          <HTML>
            <![CDATA[">]]>
          </HTML>
          <HTML>
            <![CDATA[<img src="]]>
          </HTML>
          <Column />
          <HTML>
            m
            <![CDATA[" style="border:0px;" /></a>]]>
          </HTML>
        </Default>
      </Switch>
    </RenderPattern>

First... I just saw the "m" in the middle of the code... I don't know what is it o_O I think you can remove it. Then, you just have to add width:X;height:Y in the style attribut of the picture, so :

<RenderPattern Name="DisplayPattern">
      <Switch>
        <Expr>
          <Column />
        </Expr>
        <Case Value=""></Case>
        <Default>
          <HTML>
            <![CDATA[<a href="]]>
          </HTML>
          <Column />
          <HTML>
            <![CDATA[">]]>
          </HTML>
          <HTML>
            <![CDATA[<img src="]]>
          </HTML>
          <Column />
          <HTML>
            <![CDATA[" style="border:0px;height=150;width=100;" /></a>]]>
          </HTML>
        </Default>
      </Switch>
    </RenderPattern>

Feb 16, 2010 at 12:26 PM

i was coming back here to tell how to change the xml file as it worked for me , but you were faster than me.

I did as mentionned above, works fine.

Thank you zick

Regards

Coordinator
Feb 17, 2010 at 7:38 AM

Right!

Don't hesitate to rate this codeplex if you love it ^^