Square User Avatar

16 years 10 months ago #39605 by Dionysus
Replied by Dionysus on topic Re:Square User Avatar
Can you tell me where to add in this code?

Please Log in to join the conversation.

16 years 5 months ago #48982 by cee
Replied by cee on topic Re:Square User Avatar
I think I've found the bug which made the images resize a bit funny (if they were in landscape mode).

I changed this:
[code:1]
if($width> $height) {
$x = ceil(($width - $height) / 2 );
$width = $height;
} elseif($height> $width) {
$y = ceil(($height - $width) / 2);
$height = $width;
}
$destWidth = $destHeight;
$destHeight = $destWidth;
[/code:1]

To this:
[code:1]
if($width> $height) {
$x = ceil(($width - $height) / 2 );
$width = $height;
$destHeight = $destWidth;
} elseif($height> $width) {
$y = ceil(($height - $width) / 2);
$height = $width;
$destWidth = $destHeight;
}
[/code:1]

and it worked for me.

Please Log in to join the conversation.

16 years 5 months ago #48985 by Dionysus
Replied by Dionysus on topic Re:Square User Avatar
wired wrote:

Awesome guys!! But can this be adapted to first resize then crop from the center like fredfred.net/skriker/index.php/iimage-gallery ?

crop="true" crop_center="true" max_side="100" quality="95"


That way it's just not a simple crop. Looks way better.



Where do you have to change this?

Please Log in to join the conversation.

16 years 5 months ago #49127 by cee
Replied by cee on topic Re:Square User Avatar
Dionysus - Read the thread from the beginning and it'll tell you what file to change.

Please Log in to join the conversation.

16 years 2 months ago #56935 by ffaabbss
Replied by ffaabbss on topic Re:Square User Avatar
is there a way to resize already existing avatars? so that i can use this function?

Please Log in to join the conversation.

16 years 2 months ago #56941 by ffaabbss
Replied by ffaabbss on topic Re:Square User Avatar
it does not seem to work for me. I mean the thumbnails get squared when i replace the function but my user avatars will be the maximum size defined in backend but not necessarily squared. if a user uploads a different sized image the avatar will not be square, just the thumbnails e.g. in login module are squared now...
how can i also get a square avatar cropped out?
my avatar only gets cropped if it exceeds the maximum size but it does not get croppped squared but just to maximum size on the affected side.
so if i have a max of 200*200 specified and upload an image with 200*250 it will get squared to 200*200 but if i upload an image with 200*150 it will not be 150*150 but original size :(
meaning i want the function to resize the uplaoded avatar and then crop out a square from the center.
and if the avatar is smaller than the specified maximum size it should still be cropped to a square depening on the shortest side.


Post edited by: ffaabbss, at: 2008/02/17 23:19

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.217 seconds

Facebook Twitter LinkedIn