Latest topics
» How To Install the Code Snippet Button
by SLGray Today at 20:56

» Select Button
by SLGray Today at 20:25

» FM Themes
by SLGray Today at 16:48

» User - Made Creations
by SLGray Today at 16:48

» The Football Forums
by Mati Today at 15:22

» [BUG] Avatar doesn't resize when reading the profile
by Samantha NL Today at 12:33

» Search Bar Options
by Samantha NL Today at 11:38

» Chit Chat Thread
by Jazeon Today at 05:42

» Christmas logo
by Teo! Today at 03:56

» SyncEditor
by keko_ferkeko Today at 00:31

» Private message bg color
by Mr.Alam Yesterday at 22:54

» Multi-step Login Form
by Samantha NL Yesterday at 12:54

» Member of the Month
by Samantha NL Yesterday at 12:38

» Forumactif Edge - Dutch Translation
by Samantha NL Yesterday at 10:49

» Widget : Staff Online
by Samantha NL Yesterday at 10:39

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

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

replace the default image uploader with imgur uploader

View previous topic View next topic Go down

Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on 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

when you upload an image it will show spining icon like this

after upload the image is done the image will be added instant

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
Valued Member
Title :
Owner of 2 Forums
Gender : Male
Age : 43
Posts : 2176
Points : 4077
Reputation : 246
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray on 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

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on 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
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3202
Points : 3830
Reputation : 259
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on 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..

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Mon 29 Aug 2016, 19:14

thats looks a good news to me
we dont have to worry about limits
Valoish
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3202
Points : 3830
Reputation : 259
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on 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?

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on 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
Graphic Designer
Title :
Gender : Female
Age : 20
Posts : 3202
Points : 3830
Reputation : 259
Location : NYC
Language : English, Russian, Hebrew
Browser : Browser : Opera Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://www.canvasforums.com https://twitter.com/https://twitter.com/Valoishx3

PostValoish on Tue 30 Aug 2016, 13:30

Alrighty~ I'll try it out tonight and let you know if I run into any issues :B

--------

"I was afraid. And my own insecurity crushed him." - Youku x Boku SS
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8396
Reputation : 2010
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on 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

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on 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
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8396
Reputation : 2010
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on 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

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Wed 31 Aug 2016, 11:30

thank you for the tip
ill try keep that in mind
SLGray
Valued Member
Title :
Owner of 2 Forums
Gender : Male
Age : 43
Posts : 2176
Points : 4077
Reputation : 246
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray on 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

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on 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
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8396
Reputation : 2010
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on 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
Valued Member
Title :
Owner of 2 Forums
Gender : Male
Age : 43
Posts : 2176
Points : 4077
Reputation : 246
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray on 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

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on 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

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