[Plugin: BuddyPress Activity Plus] Add Image Size
-
Hi All,
First of all; what a great plugin! It really does what it is supposed to do. I have been modifying it for a bit (mostly stylish) and right now I am stuck on trying to add an extra image size.
The reason why I want to add this is so that there will be three image sizes in total: On the activity feed it shows the thubmnail, when you click the thumbnail you get the original, and third (which will be the newly added) when you go to the single activity entry it will show an enlarged thumbnail by default.
So the code is pretty clear, and well organized (Thank you vebailovity, I think your the main developer?). But I have a difficult time finding where the “-bpfb” is being added to the picture.
This is what I am planning to do, not sure if this will work. I am not a coder at all.
Original class_bfbp_binder contains
// Override thumbnail image size in wp-config.php if (defined('BPFB_THUMBNAIL_IMAGE_SIZE')) { list($tw,$th) = explode('x', BPFB_THUMBNAIL_IMAGE_SIZE); $thumb_w = (int)$tw ? (int)$tw : $thumb_w; $thumb_h = (int)$th ? (int)$th : $thumb_h; } $processed = 0; foreach ($imgs as $img) { $processed++; if (BPFB_IMAGE_LIMIT && $processed > BPFB_IMAGE_LIMIT) break; // Do not even bother to process more. if (preg_match('!^https?:\/\/!i', $img)) { // Just add remote images $ret[] = $img; continue; } $pfx = $bp->loggedin_user->id . '_' . preg_replace('/ /', '', microtime()); $tmp_img = realpath(BPFB_TEMP_IMAGE_DIR . $img); $new_img = BPFB_BASE_IMAGE_DIR . "{$pfx}_{$img}"; if (@rename($tmp_img, $new_img)) { image_resize($new_img, $thumb_w, $thumb_h, false, 'bpfbt'); $ret[] = pathinfo($new_img, PATHINFO_BASENAME); } else return false; }
Modified version class_bfbp_binder will add this to define size
if (defined('BPFB_LARGE_IMAGE_SIZE')) { list($tw,$th) = explode('x', BPFB_LARGE_IMAGE_SIZE); $large_w = (int)$tw ? (int)$tw : $large_w ; $large_h = (int)$th ? (int)$th : $large_h ; }
And the part which actually renames the images and resizes is (I assume). How would I add a second request to this for my second image? Just add another if (@rename statement?
$pfx = $bp->loggedin_user->id . '_' . preg_replace('/ /', '', microtime()); $tmp_img = realpath(BPFB_TEMP_IMAGE_DIR . $img); $new_img = BPFB_BASE_IMAGE_DIR . "{$pfx}_{$img}"; if (@rename($tmp_img, $new_img)) { image_resize($new_img, $thumb_w, $thumb_h, false, 'bpfbt'); $ret[] = pathinfo($new_img, PATHINFO_BASENAME); }
http://wordpress.org/extend/plugins/buddypress-activity-plus/
- The topic ‘[Plugin: BuddyPress Activity Plus] Add Image Size’ is closed to new replies.