FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 38 users online :: 0 Registered, 0 Hidden and 38 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

replace the default image uploader with imgur uploader

View previous topic View next topic Go down

Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Mon 29 Aug 2016, 03:36

this trick will allow you to replace the default image uploader button with imgur uploader button
the first step you need to go to
https://api.imgur.com/oauth2/addclient
and reggister to be a member if you are not a member yet if you already a member then goto the next step
create api to use imgur
like this image blow
replace the default image uploader with imgur uploader EgNFVAK
when you upload an image it will show spining icon like this
replace the default image uploader with imgur uploader OFXg80V
after upload the image is done the image will be added instant
replace the default image uploader with imgur uploader XOO3abM
no to the Script part
in the JavaScript Manger
new
name : imgur uploader or what you like
place : in all pages to be able to use the button in new topic or reply pages
the content
Code:
;window['FormData'] && $(function(){$(function(){
   
      var imgur_client_id = 'your-imgur-id-here'; // you will get it via http://api.imgur.com/oauth2/addclient
   
      var current = 0, uploaded, xhrs, file_selector, button = $('.sceditor-button-servimg').off().click(function(){
        if(current) return finish();
        if(!file_selector) file_selector = $('<input type="file" multiple/ accept="image/*">').css({position:'absolute', top:-100}).appendTo('body').change(function (e) {
          var files = e.target.files, fd, len;
          uploaded = [], xhrs = [];
          for (var i = 0, len = files.length; i < len; i += 1) {
            if (files[i].type.indexOf('image/') && files[i].type !== 'application/pdf') continue;
            current++;
            fd = new FormData();
            fd.append('image', files[i]);
            (function(xhr){
              var num = i, xhr = jQuery.ajaxSettings.xhr();
              xhrs.push(xhr);
              xhr.open('POST', 'https://api.imgur.com/3/image');
              xhr.setRequestHeader('Authorization', 'Client-ID '+imgur_client_id);
              xhr.onreadystatechange = function () {
                if (xhr.readyState !== 4) return;
                current--;
                if (xhr.status === 200) {
                  var res = JSON.parse(xhr.responseText);
                  uploaded[num] = res.data.link;
                }
                if(!current) finish();
              };
              xhr.send(fd);
            })();
          }
          if(current) button.css({background:'url(http://i.imgur.com/EMsOJtZ.gif) no-repeat'});
        });
        file_selector.click();
        return false;
      }).children();
      var finish = function(){
        for(var i=0; i < xhrs.length; i++) {
            if(xhrs[i].readyState == 4) continue;
            xhrs[i].onreadystatechange = function(){};
            xhrs[i].abort();
        }
        for(var i=0; i < uploaded.length; i++) {
          if(uploaded[i] === undefined) continue;
          $('body').find('.sceditor-button-image').click().end().find('.sceditor-insertimage').find('#image').val(uploaded[i]).end().find('input.button').click();
          $('#text_editor_textarea').sceditor('instance').insertText('\n');
        }
        button.removeAttr('style');
        current = 0;
        file_selector.wrap('<form>').closest('form').get(0).reset();
        file_selector.unwrap();
        return false;
      };
    })});
dont forget your imgur ID
replace
your-imgur-id-here
in the 2nd line with your imgur ID that you did in the first of the topic
and save the Script
all done and have fun with the new fast uploading images and its also to imgur i think its the best image server till now
Party

Notice
Tutorial written and translated by @Michael_vx.
Credit for the script and original tutorial goes to Ea from the French Support forum.
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7345
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Mon 29 Aug 2016, 17:41

Does this mean that images uploaded by members will go into your account? If yes, would this not use up the storage for one account?
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Mon 29 Aug 2016, 18:53

will yes
but i think imgur is a great image server
so i dont think we have to worry about that part of storage
Valoish
Valoish
Graphic Designer
Gender : Female
Age : 28
Posts : 3671
Points : 7358
Reputation : 360
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB2
http://www.canvasforums.com https://twitter.com/Valoishx3

PostValoish Mon 29 Aug 2016, 18:59

I was thinking about the whole storage thing as well.. 
I did some research and it seems like there aren't any bandwidth limits set for free imgur accounts anymore.
Short article can be found here
Imgur Blog post
So doing this should be okay..
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Mon 29 Aug 2016, 19:14

thats looks a good news to me
we dont have to worry about limits
Valoish
Valoish
Graphic Designer
Gender : Female
Age : 28
Posts : 3671
Points : 7358
Reputation : 360
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB2
http://www.canvasforums.com https://twitter.com/Valoishx3

PostValoish Mon 29 Aug 2016, 19:27

@Michael_vx Considering testing this on my Forum.. But before I do, this is compatible with any version right? Not just phpBB3 or whatever else?
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Mon 29 Aug 2016, 19:28

will
it should be for all versions since its to the Editor Smile
if there a problem please let me know
Valoish
Valoish
Graphic Designer
Gender : Female
Age : 28
Posts : 3671
Points : 7358
Reputation : 360
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB2
http://www.canvasforums.com https://twitter.com/Valoishx3

PostValoish Tue 30 Aug 2016, 13:30

Alrighty~ I'll try it out tonight and let you know if I run into any issues :B
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 30 Aug 2016, 14:35

@Michael_vx Ooooh tested it and it works beautifully. loove


P.S.
You might want to give credit to the author of the script by adding a link to the tutorial at the end of your post. Wink
http://forum.forumactif.com/t381038-utiliser-imgur-comme-hebergeur-d-image

e.g. "Credit for the script goes to..", "Script by", etc..
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Tue 30 Aug 2016, 21:43

thank you for passing by my small simple woek of translation
by the waay about credits to the owner
if you want to add them i dont mind
your way in give the credits is better then my way Smile
im not good Enough in English
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 31 Aug 2016, 11:00

@Michael_vx sure no problem, I added a small notice to the end of your tutorial. Thumb right
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Wed 31 Aug 2016, 11:30

thank you for the tip
ill try keep that in mind
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7345
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Thu 01 Sep 2016, 01:10

There might not be a limit on bandwidth, but there has to be some kind of limit on a free account.  Maybe there is a limit on the storage space.  If you have a large forum that has many members, it would quickly use up any limit.

If you could figure out a way that members can use their own accounts, it would be better.
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Thu 01 Sep 2016, 04:28

not possible unless our Master @Ange Tuteur find a way to let the Script ask users for there accounts Smile
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12253
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Thu 01 Sep 2016, 10:42

Theoretically it's possible, but the user would need to register their own personal client id. I suppose after registration you could save that data to a profile field for the user, so they don't have to constantly input their id.
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7345
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Thu 01 Sep 2016, 16:36

Please do not think I am saying that this tutorial is not great, but I just was wondering about the account.
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4305
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Fri 02 Sep 2016, 03:20

@Ange Tuteur
using profile feild to imgur api so it can be saved for each user to have his own access to his images in imgur
reflect
looks great idea
Thumb left
@SLGray
no lol im not thinking about that
i know your worry about storage and space for big forums but for me since i never owned a big forum i cant tell nor good is bad to use one api for the whole users
you right in worry about big forums i cant blame you
my forum got no more then 81 member im not a user of forumotion i use MyBB forum Script and i love it


i hope Ange Tuteur add this option for so i can pick MyBB instead of other Smile
im a little sick of other Embarassed
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum