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..
Asked
Active
Viewed 148 times
2 Answers
0
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.

Jason Plank
- 2,336
- 5
- 31
- 40

Sarfraz
- 377,238
- 77
- 533
- 578
-
thanks sarfraz, is the getimagesize() function bundled in joomla or should i code stuffs into that..sorry, i'm very new to joomal – Sam Nov 26 '09 at 13:47
-
-
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 Nov 27 '09 at 10:32
-
i am not sure about which plugin are you using but shoud have in name someting like 'controller' i suspect – Sarfraz Nov 27 '09 at 10:37
-
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 Nov 27 '09 at 10:46
-1
I haven't used Joomla but you should see:
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.

Community
- 1
- 1

binarycreations
- 3,091
- 6
- 32
- 38