<?php 
    if (preg_match('!^' . preg_quote('http://') . '!i', $img)) {
        // Remote image
        ?>
		<img src="<?php 
        echo $img;
        ?>
" />
	<?php 
    } else {
        ?>
		<?php 
        $info = pathinfo($img);
        ?>
		<?php 
        $thumbnail = file_exists(bpfb_get_image_dir($activity_blog_id) . $info['filename'] . '-bpfbt.' . strtolower($info['extension'])) ? bpfb_get_image_url($activity_blog_id) . $info['filename'] . '-bpfbt.' . strtolower($info['extension']) : bpfb_get_image_url($activity_blog_id) . $img;
        ?>
		<a href="<?php 
        echo bpfb_get_image_url($activity_blog_id) . $img;
        ?>
" class="<?php 
        echo $use_thickbox;
        ?>
" rel="<?php 
        echo $rel;
        ?>
">
			<img src="<?php 
        echo $thumbnail;
        ?>
" />
 /**
  * Callback for activity images removal
  * @param  string $content Shortcode content parsed for images
  * @param  BP_Activity_Activity Activity which contains the shortcode - used for privilege check 
  * @return bool
  */
 private function _clean_up_content_images($content, $activity)
 {
     if (!Bpfb_Data::get('cleanup_images')) {
         return false;
     }
     if (!bp_activity_user_can_delete($activity)) {
         return false;
     }
     $images = BpfbCodec::extract_images($content);
     if (empty($images)) {
         return false;
     }
     foreach ($images as $image) {
         $info = pathinfo(trim($image));
         // Make sure we have the info we need
         if (empty($info['filename']) || empty($info['extension'])) {
             continue;
         }
         // Make sure we're dealing with the image
         $ext = strtolower($info['extension']);
         if (!in_array($ext, self::_get_supported_image_extensions())) {
             continue;
         }
         // Construct the filenames
         $thumbnail = bpfb_get_image_dir($activity_blog_id) . $info['filename'] . '-bpfbt.' . $ext;
         $full = bpfb_get_image_dir($activity_blog_id) . trim($image);
         // Actually remove the images
         if (file_exists($thumbnail) && is_writable($thumbnail)) {
             @unlink($thumbnail);
         }
         if (file_exists($full) && is_writable($full)) {
             @unlink($full);
         }
     }
     return true;
 }