How can I dynamically generate an image with a static image URL?

Using .htaccess rewrites wouldn’t be a good approach since it would fail when the plugin is disabled.

You also can’t rewrite image URLs with WordPress because its native request parsing does not recognize single file names. However, if an image doesn’t exist, the web server will redirect the request over to WordPress for handling. This allows us to hook in and include your dynamic image template.

add_action('init', 'wpse_44612_init', 0);
function wpse_44612_init(){
    if(preg_match('/socialproof\.png/', $_SERVER['REQUEST_URI'])){
        require_once(ABSPATH.'/wp-content/plugins/SocialProof/classes/SocialProofMakeImage.php');
        die();
    }
}

With this approach, your URL appears as a static image, but is dynamically generated via your PHP class file.

You can download the plugin file is here.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)