I really need an "image" button on the toolbar that they can click - then either upload an image or add in a URL.
While embedding a URL is simple for those who are technically savvy for many normal users its impossible to figure out.
These are: I have a picture of a kitty on my PC that I want to share with the rest of my group people. Please consider adding an "image" button that will give the option of uploading or embedding. Most forums I have been on have this option.
Hi. If paste an image link it should automatically embed already, although the image would need to be uploaded at an external website.
Alternatively, it is possible now to attache an image and submit, then edit the post again, copying the attachment link and pasting that in the post as to embed it as an image.
This is not to say that a proper image button would be nice in any case though.
The default attachments are not file type sensitive. This code can help to detect images and show those as image. You should put this code in WordPress active theme functions.php file:
add_filter('wpforo_content_after', 'wpforo_default_attachment_image_embed', 11);
function wpforo_default_attachment_image_embed( $content ){
if( preg_match_all('|<a class=\"wpforo\-default\-attachment\" href\=\"([^\"\']+)\"[^><]*>.+?<\/a>|is', $content, $data, PREG_SET_ORDER) ){
foreach($data as $array){
if(isset($array[1])){
$file = $array[1];
$e = strtolower(substr(strrchr($file, '.'), 1));
if( $e === 'jpg' || $e === 'jpeg' || $e === 'png' || $e === 'gif' || $e === 'bmp' || $e === 'webp' ){
$filename = explode('/', $file); $filename = end($filename);
$html = '<a href="' . esc_url($file) . '" target="_blank"><img class="wpforo-default-image-attachment" src="' . esc_url($file) . '" alt="' . esc_attr($filename) . '" title="' . esc_attr($filename) . '" /></a>';
$content = str_replace($array[0], $html, $content);
}
}
}
}
return $content;
}
How to easily add custom code WordPress active theme functions.php file (without Breaking Your Site)
For an advanced file attachments features please check wpForo Advanced Attachments addon: https://gvectors.com/product/wpforo-advanced-attachments/
What exactly does this code do?
Does this detetch if the attachment is a photo, then displays it inside the post? If so, can this be edited to show a photo with dynamic resizing? I.e, it fits to the window on both desktop and mobile?
Does this detetch if the attachment is a photo, then displays it inside the post?
This will replace attached image link to image.
If so, can this be edited to show a photo with dynamic resizing? I.e, it fits to the window on both desktop and mobile?
All images in posts are responsive, this is too.