tags:

views:

36

answers:

2

hi! i'm using joomla and want to restrict the user profile image size(dimension). it is default to 10Mb but i want to restrict the image dimension something like 240x320 and below can be uploaded.. thanks..

A: 

I haven't used Joomla but you should see:

http://stackoverflow.com/questions/672916/how-to-get-image-height-and-width-using-java

If you are able to load the image into memory you could use Java's awt.Image class to get the width and height of the image and reject the image or scale the image to the desired size. Have a look at:

http://java.sun.com/j2se/1.5.0/docs/api/

I know that you can use JavaScript with Joomla so perhaps this would be worth a view: link text - Uses javascript to get image dimensions.

I hope this is some help to you.

Graham
you mix up joomla with java
streetparade
A: 

You should hack into the joomla code for that particular upload thing and use code like this for it:

list($width, $height) = getimagesize($image_file);

if ($width == 240 && $height == 320) { // nice proceed } else { // oops, invalid dimensions }

I suspect you should place this code in controller of the plugin/component you are using the upload feature of.

Thanks

Sarfraz
thanks sarfraz,is the getimagesize() function bundled in joomla or should i code stuffs into that..sorry, i'm very new to joomal
Sam
it is built-in php function, you can use it straight away
Sarfraz
i wanna restrict the image size of user profile page..can u tell me in which page the upload processing is done so that i'll use ur code..
Sam
i am not sure about which plugin are you using but shoud have in name someting like 'controller' i suspect
Sarfraz
i've a lot of controllers.php file :(how to find the plugins used? shall i give u the list of folder names in my plugins folder? will that help?
Sam
show names please.
Sarfraz