Support » Plugin: Simple Local Avatars » BUG SIZE IMG

Viewing 2 replies - 1 through 2 (of 2 total)
  • dmagin

    (@dmagin)

    the problem is not only the KB Size, also if your PHP ini have not to much memory for the process the automatic resize engine in wordpress create the exception.

    i changed one line in the source to limit the heigh and width for the upload in simple local avatars.

    go in the simple-local-avatar.php

    navigate to method: public function edit_user_profile_update( $user_id ) {..
    you find at the end the line:

    update_user_meta( $user_id, 'simple_local_avatar', array( 'full' => $avatar['url'] ) );		// save user information (overwriting old)

    override this line with

    list( $width, $height, $imagetype, $hwstring, $mime, $rgb_r_cmyk, $bit ) = getimagesize( $avatar['url'] );
    			$img_size = get_headers( $avatar['url'],1);
                if(($width * $height > 40000) or (round($img_size["Content-Length"]/1000)>200)) {
                  echo 'Errormessage.......';
                 }
                else {
                  update_user_meta( $user_id, 'simple_local_avatar', array( 'full' => $avatar['url'] ) );		// save user information (overwriting old)
                  }

    i am not a php developer but i fixed this and it works great 🙂

    JibsouX

    (@jibsoux)

    Hellow thaaannnkk dude !!!

    i have inprove the code you gave me :

    1 : disable ‘displaying error’ put this after the FIRST ‘<?php’ like this :

    <?php
    ini_set('display_errors','off');
    /**
     Plugin Name: Simple Lo...

    then this is your code with litle tweak ^^:

    list( $width, $height, $imagetype, $hwstring, $mime, $rgb_r_cmyk, $bit ) = getimagesize( $avatar['url'] );
    			$img_size = get_headers( $avatar['url'],1);
                if(($width * $height > 40000) or (round($img_size["Content-Length"]/1000)>200)) {
                  echo '<b style="font-size:35px;">Your avatar is to big, choose another image ! <a href="http://you-domain-name.com/wp-admin/profile.php">// BACK //</a>';
                 }
                else {
                  update_user_meta( $user_id, 'simple_local_avatar', array( 'full' => $avatar['url'] ) );		// save user information (overwriting old)

    VOILA ^^

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘BUG SIZE IMG’ is closed to new replies.