Support » Plugin: BuddyPress Activity Plus » [Plugin: BuddyPress Activity Plus] Uploaded images missing

  • jasonatpace


    First of all, thanks for providing a great plugin, it is extremely useful.

    However, I found a couple of problems on our installation. The links and remote content was working fine, but I could not get images to appear if they were uploaded locally. I tracked this down to two issues. I don’t know enough about the “internals” of Buddypress, so I cannot offer a proper fix, only workarounds. The code for the workarounds is given below. Perhaps someone can fix this properly?



    Problem 1: PHP versions.
    I am using PHP 5.1.6 which does not support the “filename” parameter to “pathinfo”. Filenames were therefore not being processed correctly. I worked around this by performing a regular expression match instead in images_tag_template.php and file_uploader.php

    Problem 2: image resizing. Under certain conditions, the image resizing does not give rise to a thumbnail. I haven’t had time to investigate why exactly this is, it’s possibly when the image is small. In this case, no image with a “-bpfbt” was being created. The workaround was to see if this image exists, and if it does not, link to the original image.

    Code workaround in images_tag_template.php (starting at line 10 to the end of the “” link):

    <?php preg_match('/^(.+)\.([^.]+)?$/', $img, $info);
                $ThumbExt = '-bpfbt';
                if (!file_exists(BPFB_BASE_IMAGE_DIR.$info[1] . $ThumbExt . "." . strtolower($info[2]))) {
                  $ThumbExt = "";
    		<a>" class="thickbox" rel="<?php echo $rel;?>">
    			<img src="<?php echo bpfb_get_image_url($activity_blog_id) . $info[1] . $ThumbExt . "." . strtolower($info[2]); ?>" />

    Code workaround for file_uploader.php (from line 128):

    //$pathinfo = pathinfo($this->file->getName());
            preg_match('/^(.+)\.([^.]+)?$/', $this->file->getName(), $thisfileinfo);
            $filename = strtolower($thisfileinfo[1]);
            $ext = strtolower($thisfileinfo[2]);
            //$filename = strtolower($pathinfo['filename']);
            //$filename = md5(uniqid());
            //$ext = strtolower($pathinfo['extension']);

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: BuddyPress Activity Plus] Uploaded images missing’ is closed to new replies.