WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Activity Plus
Uploaded images missing (5 posts)

  1. jasonatpace
    Member
    Posted 3 years ago #

    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?

    Cheers

    Jason

    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]); ?>" />
    		</a>

    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']);

    http://wordpress.org/extend/plugins/buddypress-activity-plus/

  2. masonjames
    Volunteer Moderator
    Posted 3 years ago #

    Hiya,

    Just want to mention that as of WordPress 3.2 (due shortly) PHP 5.2 will be the minimum requirement:
    http://wordpress.org/news/2010/07/eol-for-php4-and-mysql4/

    We'll look into the other issue though. See what can be done. Thanks for the detailed feedback!

  3. masonjames
    Volunteer Moderator
    Posted 3 years ago #

    Just as a further update, the image resizing for small images will be fixed in 1.1.1

    Thanks for letting us know!

  4. jasonatpace
    Member
    Posted 3 years ago #

    Hi masonjames,

    Just to say "thanks" for your speedy replies; I look forward to future releases.

    Cheers

    Jason

  5. masonjames
    Volunteer Moderator
    Posted 3 years ago #

    My pleasure :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic