Support » Plugin: User Avatar » [Plugin: User Avatar] Picture does not display

Viewing 5 replies - 1 through 5 (of 5 total)
  • mediabebascom


    hello guys,

    In order for this plugin can work well, easy as pie. You just remove all the existing code in timthumb-config.php file with the following code below:

    if( isset($_GET['id']) && is_numeric($_GET['id']) ){
    	$id = $_GET['id'];
    	if( !strpos( $_GET['src'],"/avatars/".$id."/" ) )
    } else {
    // this is the standard set up with wp-content living 3 levels down
    define ('WP_CONTENT_DIR', dirname(dirname(dirname(__FILE__))));
    define ('AVATARS_DIR',WP_CONTENT_DIR.'/uploads/avatars/');
    // cache the file inside the avatar directory
    // please modify this to your hearts content
    if(! defined('FILE_CACHE_DIRECTORY') ) 		define ('FILE_CACHE_DIRECTORY', AVATARS_DIR.$id.'/cache');
    // this are pretty much the standard settings
    if(! defined('DEBUG_ON') )					define ('DEBUG_ON', false);								// Enable debug logging to web server error log (STDERR)
    if(! defined('DEBUG_LEVEL') )				define ('DEBUG_LEVEL', 1);								// Debug level 1 is less noisy and 3 is the most noisy
    if(! defined('MEMORY_LIMIT') )				define ('MEMORY_LIMIT', '30M');							// Set PHP memory limit
    if(! defined('BLOCK_EXTERNAL_LEECHERS') ) 	define ('BLOCK_EXTERNAL_LEECHERS', false);				// If the image or webshot is being loaded on an external site, display a red "No Hotlinking" gif.
    //Image fetching and caching
    if(! defined('ALLOW_EXTERNAL') )			define ('ALLOW_EXTERNAL', TRUE);						// Allow image fetching from external websites. Will check against ALLOWED_SITES if ALLOW_ALL_EXTERNAL_SITES is false
    if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) 	define ('ALLOW_ALL_EXTERNAL_SITES', false);				// Less secure.
    if(! defined('FETCH_LOCAL_URLS') )          define ('FETCH_LOCAL_URLS', false);                     // If true, URL sources will always be fetched over HTTP, even if they have the same hostname as this script
    if(! defined('FILE_CACHE_ENABLED') ) 		define ('FILE_CACHE_ENABLED', TRUE);					// Should we store resized/modified images on disk to speed things up?
    if(! defined('FILE_CACHE_TIME_BETWEEN_CLEANS'))	define ('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400);	// How often the cache is cleaned 
    if(! defined('FILE_CACHE_MAX_FILE_AGE') ) 	define ('FILE_CACHE_MAX_FILE_AGE', 86400);				// How old does a file have to be to be deleted from the cache
    if(! defined('FILE_CACHE_SUFFIX') ) 		define ('FILE_CACHE_SUFFIX', '.timthumb.txt');			// What to put at the end of all files in the cache directory so we can identify them
    if(! defined('FILE_CACHE_PREFIX') ) 		define ('FILE_CACHE_PREFIX', 'timthumb');				// What to put at the beg of all files in the cache directory so we can identify them
    if(! defined('FILE_CACHE_DIRECTORY') ) 		define ('FILE_CACHE_DIRECTORY', './cache');				// Directory where images are cached. Left blank it will use the system temporary directory (which is better for security)
    if(! defined('MAX_FILE_SIZE') )				define ('MAX_FILE_SIZE', 10485760);						// 10 Megs is 10485760. This is the max internal or external file size that we'll process.
    if(! defined('CURL_TIMEOUT') )				define ('CURL_TIMEOUT', 20);							// Timeout duration for Curl. This only applies if you have Curl installed and aren't using PHP's default URL fetching mechanism.
    if(! defined('WAIT_BETWEEN_FETCH_ERRORS') )	define ('WAIT_BETWEEN_FETCH_ERRORS', 3600);				//Time to wait between errors fetching remote file
    //Browser caching
    if(! defined('BROWSER_CACHE_MAX_AGE') ) 	define ('BROWSER_CACHE_MAX_AGE', 864000);				// Time to cache in the browser
    if(! defined('BROWSER_CACHE_DISABLE') ) 	define ('BROWSER_CACHE_DISABLE', false);				// Use for testing if you want to disable all browser caching
    //Image size and defaults
    if(! defined('MAX_WIDTH') ) 			define ('MAX_WIDTH', 1500);									// Maximum image width
    if(! defined('MAX_HEIGHT') ) 			define ('MAX_HEIGHT', 1500);								// Maximum image height
    if(! defined('NOT_FOUND_IMAGE') )		define ('NOT_FOUND_IMAGE', '');								// Image to serve if any 404 occurs
    if(! defined('ERROR_IMAGE') )			define ('ERROR_IMAGE', '');									// Image to serve if an error occurs instead of showing error message
    if(! defined('PNG_IS_TRANSPARENT') ) 	define ('PNG_IS_TRANSPARENT', FALSE);  //42 Define if a png image should have a transparent background color. Use False value if you want to display a custom coloured canvas_colour
    if(! defined('DEFAULT_Q') )				define ('DEFAULT_Q', 90);									// Default image quality. Allows overrid in timthumb-config.php
    if(! defined('DEFAULT_ZC') )			define ('DEFAULT_ZC', 1);									// Default zoom/crop setting. Allows overrid in timthumb-config.php
    if(! defined('DEFAULT_F') )				define ('DEFAULT_F', '');									// Default image filters. Allows overrid in timthumb-config.php
    if(! defined('DEFAULT_S') )				define ('DEFAULT_S', 0);									// Default sharpen value. Allows overrid in timthumb-config.php
    if(! defined('DEFAULT_CC') )			define ('DEFAULT_CC', 'ffffff');							// Default canvas colour. Allows overrid in timthumb-config.php
    //Image compression is enabled if either of these point to valid paths
    //These are now disabled by default because the file sizes of PNGs (and GIFs) are much smaller than we used to generate.
    //They only work for PNGs. GIFs and JPEGs are not affected.
    if(! defined('OPTIPNG_ENABLED') ) 		define ('OPTIPNG_ENABLED', false);
    if(! defined('OPTIPNG_PATH') ) 			define ('OPTIPNG_PATH', '/usr/bin/optipng'); //This will run first because it gives better compression than pngcrush.
    if(! defined('PNGCRUSH_ENABLED') ) 		define ('PNGCRUSH_ENABLED', false);
    if(! defined('PNGCRUSH_PATH') ) 		define ('PNGCRUSH_PATH', '/usr/bin/pngcrush'); //This will only run if OPTIPNG_PATH is not set or is not valid

    You can see the examples that make this plugin run well on our website at

    or directly to this link:

    Members link



    Still doesn’t work!

    My solution

    open user-avatar.php

    fide next code on line 596
    $avatar_src = "/wp-content/uploads/avatars/".$item_id."/".$avatar_img;

    and replace

    $avatar_src = get_site_url()."/wp-content/uploads/avatars/".$item_id."/".$avatar_img;

    and finde next code on line 602

    $avatar_url = plugins_url('/user-avatar/user-avatar-pic.php')."?src=".$avatar_src ."&w=".$width."&id=".$item_id."&random=".$file_time;

    and replace

    $avatar_url = $avatar_src;

    Hi Mexalim,
    Your solution works! I had installed this plugin but was having the same problem everyone else was having. Then I followed your directions, and now I can see the avatars.

    Thanks so much for sharing!

    Rita Lorraine

    Pretty bogus that you have to edit a plugin to make it work, isn’t it?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: User Avatar] Picture does not display’ is closed to new replies.