The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    replacing Servimg with Photobucket or Imageshack for image uploads

    BlackScorpion
    BlackScorpion
    Graphic Designer
    Graphic Designer


    Male Posts : 7044
    Reputation : 920
    Language : English
    Location : USA

    Solved replacing Servimg with Photobucket or Imageshack for image uploads

    Post by BlackScorpion May 8th 2014, 10:43 pm

    I have seen a few forums where the image upload was changed to imageshack or another image hosting service, Is there any code or script for me to do this to my forum? I'm running PunnBB on my Server
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: replacing Servimg with Photobucket or Imageshack for image uploads

    Post by Ange Tuteur May 9th 2014, 1:06 am

    Hi BlackScorpion,

    I have written up a quick draft, you can find it below. Smile

    Modules > Javascript codes management > create a new script

    Title : Your choice
    Placement : In the topics, or in all pages
    Paste the code below and save :
    Code:
    $(window).load(function() {
     Â   var settings = {
     Â       image : 'http://i56.servimg.com/u/f56/18/21/60/73/icon10.png', // button image
     Â       upload : 'http://photobucket.com/upload', // iframe upload url
     Â       height : '250px', // iframe height
     Â       width : '500px' // iframe width
     Â   };
     Â   
     Â   $('.sceditor-button-servimg').after('<a class="sceditor-button sceditor-button-pb"><div style="background-image:url(' + settings.image + ')"></div></a>');
     Â   $('body').append('<div id="pb_container" class="sceditor-dropdown" style="display:none;"></div>');
     Â   
     Â   $('.sceditor-button-pb').click(function() {
     Â       var X = $('.sceditor-button-pb').offset().left;
     Â       var Y = $('.sceditor-button-pb').offset().top + 25;
     Â       
     Â       if (!document.getElementById('pb_frame') && $('#pb_container').css('display') == 'none') $('#pb_container').show().css('left',X + 'px').css('top',Y + 'px').append('<iframe id="pb_frame" style="border:none;height:' + settings.height + ';width:' + settings.width + ';" src="' + settings.upload + '"></iframe>');
     Â       else if ($('#pb_container').css('display') == 'none') $('#pb_container').show().css('left',X + 'px').css('top',Y + 'px');
     Â       else $('#pb_container').hide();
     Â   });
     Â   
     Â   $('.sceditor-button:not(.sceditor-button-pb), .sceditor-container textarea, .sceditor-container iframe').click(function() { $('#pb_container').hide() });
     Â   $('.sceditor-container iframe').contents().mousedown(function() { $('#pb_container').hide() });
     Â   $('.sceditor-button-source').click(function() { $('.sceditor-button-pb').removeClass('disabled') });
    });

    There are some settings at the top which let you customize it :
    Code:
       var settings = {
     Â       image : 'http://i56.servimg.com/u/f56/18/21/60/73/icon10.png', // button image
     Â       upload : 'http://photobucket.com/upload', // iframe upload url
     Â       height : '250px', // iframe height
     Â       width : '500px' // iframe width
     Â   };

    They're marked with comments so they should be self explanatory, just make sure that your content is always between the single quotes to prevent bugs.

    Ooh if you want to hide the old upload button, just add this to your Stylesheet :
    Code:
    .sceditor-button-servimg { display:none !important; }
    BlackScorpion
    BlackScorpion
    Graphic Designer
    Graphic Designer


    Male Posts : 7044
    Reputation : 920
    Language : English
    Location : USA

    Solved Re: replacing Servimg with Photobucket or Imageshack for image uploads

    Post by BlackScorpion May 9th 2014, 1:59 am

    Thank you Ange, as always, you saved me again.   Razz

    Solved.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: replacing Servimg with Photobucket or Imageshack for image uploads

    Post by SLGray May 9th 2014, 2:01 am

    Topic Solved & Archived



    image host - replacing Servimg with Photobucket or Imageshack for image uploads Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is November 13th 2024, 6:59 pm