By yangke on
I tried:
<?php
theme_image('mypicture.jpg', 'my alt', 'my title', array('width'=>'250px', 'height'=>'10px'));
?>but my picture isn't resized (it shows in original size)
I can't find examples of the attributes array..
API says: associative array of html attributes (which is what i give it afaik)
Comments
Solved for me
Hi yangke,
I think I found a solution for you. Here is the function for theme_image: http://api.drupal.org/api/function/theme_image/6 (I think you know it already...). The last parameter, $getsize, if it is not specified, the default is TRUE. That means that your width/height attributes will be overwritten by the image original width and height.
So, here would be the correct call to theme image:
theme('image', 'mypicture.jpg', 'my alt', 'my title', array('width'=>'250px', 'height'=>'10px'), TRUE);
Btw, whenever you call a theme function, the drupal way of calling these functions is this: theme("theme_name", parameter1, parameter2, ...);
This type of calling allows you to rewrite you themes. For example, in case of theme_image: this is the function that is called by default if you do not overwrite this function in your template.php for example with a name like this one: themename_image()
Vasi.
thanks
thanks Vasi!
does the trick.
(last argument false otherwise it uses original size, as you explained)
thanks guys
exactly same as what I was looking for.