Imagem com links no fórum

3 participantes

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Tópico resolvido Imagem com links no fórum

Mensagem por Huemerson FMG 05.09.18 13:06

Detalhes da questão


Endereço do fórum: http://familiagarcia-samp.forumeiros.com/
Versão do fórum: phpBB3

Descrição


Bom dia. Preciso inserir imagens no fórum, mas com um link onde ao clicar na imagem o membro será direcionado para um determinado link, onde cada imagem terá seu próprio link.
Tentei utilizar o tutorial: "https://ajuda.forumeiros.com/t112286-link-para-download-em-imagem?highlight=imagem+com+link", mas não deu certo não aparece a imagem e o link fica quebrado como mostra este link: http://familiagarcia-samp.forumeiros.com/t37-jogos-gratis-para-a-familia#42

Pode me ajudar por favor...
avatar

Huemerson FMG
*

Membro desde : 19/06/2018
Mensagens : 45
Pontos : 101

http://fmgsamprpgvr-garcia.forumeiros.com/forum https://www.facebook.com/huemerson.garcia?ref=bookmarks

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Imagem com links no fórum

Mensagem por tikky 05.09.18 13:53

Olá @Huemerson FMG,
O Senhor removeu acidentalmente um primeiro / do código, o Senhor atualmente têm o código assim:
Código:
*
 *  Application: Create New BBCode Tags
 *  Date: 18/05/2018
 *  Version: 1.321052018
 *  Copyright (c) 2018 Daemon <help.forumotion.com>
 *  This work is free. You can redistribute it and/or modify it
 */
(function() {
    BBParser = {
        initialize: function() {
            $(function() {
                BBParser.setupBBParser();
            });
        },
        add: [
            /*
            * Note: Add a comma at the end of each new entry
            * '{option}' corresponds to the optional tag title, and '{content}' correspond to the text between the tags
            */
            {
                tag: 'download',
                close: false,
                replacement: '<a href={option}><img src="https://i.imgur.com/WW2efTS.png" /></a>'
            },

            {
                tag: 'guest',
                close: true,
                replacement: '<div class="guest">{content}</div>',
                replace: function(option, content) {
                    if (_userdata.session_logged_in < 1) {
                        return 'You need to be logged in to view this content';
                        return content;
                    }
                }
            }

            // Note: Do not add a comma at the end of the last entry
        ],
        // Do not change anything down
        validateTag: function(a) {
            if (!/^\w+$/.test(a)) throw new RangeError("You added an invalid tag: " + a);
        },
        replacers: function(a, b, c) {
            return (a || "").replace(/{option}/g, b || "").replace(/{content}/g, c || "");
        },
        optionReg: /.*?=("|'|)(.*?)\1\]/,
        parsedContent: function(a, b, c) {
            return a.replace(c ? RegExp("(\\[" + b.tag + "[^\\]]*\\])([\\s\\S]*?)\\[/" + b.tag + "]", "g" + (b.insensitive ? "i" : "")) : RegExp("\\[" + b.tag + "[^\\]]*\\]", "g" + (b.insensitive ? "i" : "")), function(d, e, f) {
                c || (e = d);
                e = BBParser.optionReg.test(e) ? e.replace(BBParser.optionReg, "$2") : b.defaultOption;
                if ("undefined" !== typeof b.replace) {
                    d = c ? b.replace(e, f) : b.replace(e);
                    "string" === typeof d ? c ? f = d : e = d : d;
                    "object" === typeof d && (e = d.option || e, f = d.content || f);
                }
                return BBParser.replacers(b.replacement, e, f);
            });
        },
        setupBBParser: function() {
            var postBody = $(".postbody, .blog_message");
            for (var i = 0, e;
                (e = postBody[i++]);) {
                for (var j in BBParser.add) {
                    var item = BBParser.add[j];
                    // Validating tag
                    BBParser.validateTag(item.tag);
                    e.innerHTML = BBParser.parsedContent(e.innerHTML, item, item.close);
                }
            }
        }
    };
    BBParser.initialize();
})();

O correto é:
Código:
/*
 *  Application: Create New BBCode Tags
 *  Date: 18/05/2018
 *  Version: 1.321052018
 *  Copyright (c) 2018 Daemon <help.forumotion.com>
 *  This work is free. You can redistribute it and/or modify it
 */
(function() {
    BBParser = {
        initialize: function() {
            $(function() {
                BBParser.setupBBParser();
            });
        },
        add: [
            /*
            * Note: Add a comma at the end of each new entry
            * '{option}' corresponds to the optional tag title, and '{content}' correspond to the text between the tags
            */
            {
                tag: 'download',
                close: false,
                replacement: '<a href={option}><img src="https://i.imgur.com/WW2efTS.png" /></a>'
            },

            {
                tag: 'guest',
                close: true,
                replacement: '<div class="guest">{content}</div>',
                replace: function(option, content) {
                    if (_userdata.session_logged_in < 1) {
                        return 'You need to be logged in to view this content';
                        return content;
                    }
                }
            }

            // Note: Do not add a comma at the end of the last entry
        ],
        // Do not change anything down
        validateTag: function(a) {
            if (!/^\w+$/.test(a)) throw new RangeError("You added an invalid tag: " + a);
        },
        replacers: function(a, b, c) {
            return (a || "").replace(/{option}/g, b || "").replace(/{content}/g, c || "");
        },
        optionReg: /.*?=("|'|)(.*?)\1\]/,
        parsedContent: function(a, b, c) {
            return a.replace(c ? RegExp("(\\[" + b.tag + "[^\\]]*\\])([\\s\\S]*?)\\[/" + b.tag + "]", "g" + (b.insensitive ? "i" : "")) : RegExp("\\[" + b.tag + "[^\\]]*\\]", "g" + (b.insensitive ? "i" : "")), function(d, e, f) {
                c || (e = d);
                e = BBParser.optionReg.test(e) ? e.replace(BBParser.optionReg, "$2") : b.defaultOption;
                if ("undefined" !== typeof b.replace) {
                    d = c ? b.replace(e, f) : b.replace(e);
                    "string" === typeof d ? c ? f = d : e = d : d;
                    "object" === typeof d && (e = d.option || e, f = d.content || f);
                }
                return BBParser.replacers(b.replacement, e, f);
            });
        },
        setupBBParser: function() {
            var postBody = $(".postbody, .blog_message");
            for (var i = 0, e;
                (e = postBody[i++]);) {
                for (var j in BBParser.add) {
                    var item = BBParser.add[j];
                    // Validating tag
                    BBParser.validateTag(item.tag);
                    e.innerHTML = BBParser.parsedContent(e.innerHTML, item, item.close);
                }
            }
        }
    };
    BBParser.initialize();
})();


Cordialmente,
pedxz.
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7821
Pontos : 9063

Ir para o topo Ir para baixo

Tópico resolvido Re: Imagem com links no fórum

Mensagem por Huemerson FMG 05.09.18 14:34

Obrigado, mas encontrei outro tópico de ajuda com um código direto no fórum e ficou como eu queria.
Obrigado.

"[url=URL DO LINK]Imagem - Imagem com links no fórum URL IMAGEM[/url]"

Pode encerrar o tópico.
avatar

Huemerson FMG
*

Membro desde : 19/06/2018
Mensagens : 45
Pontos : 101

http://fmgsamprpgvr-garcia.forumeiros.com/forum https://www.facebook.com/huemerson.garcia?ref=bookmarks

Ir para o topo Ir para baixo

Tópico resolvido Re: Imagem com links no fórum

Mensagem por Neox 05.09.18 19:02

Tópico resolvido


Movido para "Questões resolvidas".
Neox

Neox
Membro

Membro desde : 16/08/2016
Mensagens : 698
Pontos : 976

https://ajuda.forumeiros.com

Ir para o topo Ir para baixo

Ver o tópico anterior Ver o tópico seguinte Ir para o topo


Permissões neste sub-fórum
Não podes responder a tópicos