AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] How to show beautiful pictures?

3 Posts
3 Users
0 Reactions
1,640 Views
good999
Posts: 12
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@good999)
Eminent Member
Joined: 6 years ago
[#12978]

I have bought wpForo Advanced Attachments. But media pictures will not be stored on Amazon s3.
So I have to give up the plug-in, I now stop the wpForo Advanced Attachments plugin.
How to show pictures, not a string of text (xxxx.jpg)
. How to show beautiful pictures?

 991187

2 Replies
netvilox
Posts: 64
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@netvilox)
Estimable Member
Joined: 7 years ago

You may try this code, add it to your themes function. 

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') {

                    $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;

}

Alvina
Posts: 1857
Moderator
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@alvina)
Member
Joined: 7 years ago

Hi @good999,

Please try to use the code provided above. 

Please let us know, are the media files stored on Amazon s3, when you use the wpforo default attachment?

Also please leave the example URL to allow us to check it.


Share: