Advertisement:

Author Topic: Simple Image Upload  (Read 145819 times)

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Simple Image Upload
« Reply #220 on: March 27, 2020, 06:28:59 AM »
I wonder how to change the type of inserted link from this modification? A link to the thumbnail image is currently being inserted, and I would like to change it to a direct link. Can it be changed? 8)

The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline Adrek

  • Sophist Member
  • *****
  • Posts: 1,086
  • Gender: Male
    • pages/smfpl/171860759503032 on Facebook
    • Adrek.pl
Re: Simple Image Upload
« Reply #221 on: March 28, 2020, 04:20:04 PM »
According to JS file, uploaded image result should be hotlinked image file, but since that does not happen I think that they (imgbb.com) changed how script works on their end and hotlinking is disabled.
Polskie wsparcie SMF na simplemachines.org

the simplest solution is most likely the right one

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Simple Image Upload
« Reply #222 on: March 30, 2020, 02:59:31 AM »
I understand. Thank you for the clarification. :)
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!

Offline cornflakes

  • Semi-Newbie
  • *
  • Posts: 10
Re: Simple Image Upload
« Reply #223 on: May 26, 2020, 10:44:08 PM »
Well, given that the mod authors never repsonded to my concern, here or on their own site...

the index.template.php code add should be corrected

this is what the code should look like after adjustment...

Code: [Select]
if ($context['current_action'] == 'post') {
  echo '
    <script type="text/javascript" async src="Themes/default/scripts/imgbb.js" charset="utf-8"></script>';
  }
  echo '
</body></html>';

this way, the image javascript is ONLY loaded on the post page - not on every page load.


Hi!  I'm new.  So this corrected code you wrote down....am I able to edit this or were you just writing down what it should be for the author of this mod?    If it's editable by the user (me), I'd like to change it to yours so it doesn't do what you said (only loads on the post page not on every page load).

Thanks

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,373
  • Gender: Male
    • Kindred-999 on GitHub
Re: Simple Image Upload
« Reply #224 on: May 27, 2020, 12:58:56 AM »
After you install the mod you can manually change the code to match what I wrote
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Offline cornflakes

  • Semi-Newbie
  • *
  • Posts: 10
Re: Simple Image Upload
« Reply #225 on: May 27, 2020, 02:29:13 AM »
After you install the mod you can manually change the code to match what I wrote

Ok thanks!

Offline jsx

  • Full Member
  • ***
  • Posts: 536
  • Gender: Male
Re: Simple Image Upload
« Reply #226 on: May 15, 2021, 04:08:30 AM »
Does anyone know how to replace the dot before "Add image to post" in the code with an icon for this service?





imgbb.js:

Code: [Select]
if(imgbb_lang=="en"){imgbb_lang="";}else if(imgbb_lang.indexOf(".")===-1){imgbb_lang+=".";}if(window.location.hash){var imgbb_text;var imgbb_hash;if(window.name.indexOf("imgbb_")===-1){imgbb_text=window.name;imgbb_hash=window.location.hash.substring(1).split("_");}else{imgbb_text=window.location.hash.substring(1);imgbb_hash=window.name.split("_");}if(imgbb_text!="" && imgbb_hash.length>1){if(imgbb_hash[0]=="imgbb"){var imgbb_id=imgbb_hash[1];imgbb_text=decodeURIComponent(imgbb_text);if(imgbb_text.length>20){if(opener!=null && !opener.closed){var imgbb_area=opener.document.getElementsByTagName('textarea');for(var i=0;i<imgbb_area.length;i++){if(i==imgbb_id){var editor=false;if(typeof opener.smf_editorArray==='object'){for(var A in opener.smf_editorArray){if(opener.smf_editorArray[A].opt.sUniqueId==imgbb_area[i].id){opener.smf_editorArray[A].insertText(opener.smf_editorArray[A].getText()+imgbb_text,true);editor=true;}}}if(editor==false){imgbb_area[i].value=imgbb_area[i].value+imgbb_text;}opener.focus();window.close();}}}}window.location.replace("//" + imgbb_lang + "imgbb.com/upload?mode=code&url=" + encodeURIComponent(document.location.href));}}}function imgbb_insert(){var imgbb_area=document.getElementsByTagName('textarea');for(var i=0;i<imgbb_area.length;i++){if(imgbb_area[i].name && !imgbb_skip_textarea.test(imgbb_area[i].name)){var attr=imgbb_area[i].getAttribute('data-imgbb');if(attr!="true"){var imgbb_div=document.createElement('div');imgbb_div.setAttribute('class',"imgbb");var imgbb_a=document.createElement('a');imgbb_a.innerHTML=imgbb_add_text;imgbb_a.href="javascript:imgbb_upload("+i+");";var imgbb_bullet=document.createElement('span');imgbb_bullet.setAttribute('class',"imgbb_bullet");imgbb_bullet.innerHTML="&#160;&#8226;&#160;";imgbb_div.appendChild(imgbb_bullet);imgbb_div.appendChild(imgbb_a);imgbb_area[i].setAttribute('data-imgbb',"true");if(new RegExp("quick","i").test(imgbb_area[i].name)==false && imgbb_area[i].nextElementSibling && new RegExp("resize","i").test(imgbb_area[i].nextElementSibling.id)){imgbb_div.setAttribute('style',imgbb_style);imgbb_area[i].parentNode.insertBefore(imgbb_div,imgbb_area[i].nextSibling);}else if(new RegExp("quick","i").test(imgbb_area[i].name)==false && imgbb_area[i].parentNode.nextElementSibling && new RegExp("resize","i").test(imgbb_area[i].parentNode.nextElementSibling.id)){imgbb_div.setAttribute('style',imgbb_style);imgbb_area[i].parentNode.parentNode.appendChild(imgbb_div);}else if(new RegExp("quick","i").test(imgbb_area[i].name)==false && imgbb_area[i].nextElementSibling && imgbb_area[i].nextElementSibling.nextElementSibling && new RegExp("resize","i").test(imgbb_area[i].nextElementSibling.nextElementSibling.id)){imgbb_div.setAttribute('style',imgbb_style);imgbb_area[i].parentNode.insertBefore(imgbb_div,imgbb_area[i].nextSibling.nextSibling);}else{if(imgbb_area[i].nextSibling.nextSibling){imgbb_area[i].parentNode.insertBefore(imgbb_div,imgbb_area[i].nextSibling.nextSibling);}else if(imgbb_area[i].nextSibling){imgbb_area[i].parentNode.insertBefore(imgbb_div,imgbb_area[i].nextSibling);}else{imgbb_area[i].parentNode.appendChild(imgbb_div);}}}}}}function imgbb_upload(areaid){window.open("//" + imgbb_lang + "imgbb.com/upload?mode=smf&url=" + encodeURIComponent(document.location.href),"imgbb_" + areaid,"resizable=yes,width=720,height=550");return void(0);}if(typeof(window.addEventListener)=='function'){window.addEventListener('DOMContentLoaded',imgbb_insert,false);window.addEventListener('load',imgbb_insert,false);}else if(typeof(window.attachEvent)=='function'){window.attachEvent('onload',imgbb_insert);}else{if(window.onload!=null){var old_onload=window.onload;window.onload=function(e){old_onload(e);imgbb_insert();};}else{window.onload=imgbb_insert;}}for(var i=1;i<12;i+=2){setTimeout("imgbb_insert()",i*1000);}imgbb_insert();}
The Great Winged Hussars

https://www.youtube.com/watch?v=DCdNC1i2eZE

We remember
In september
When The Winged Hussars arrived!