npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

image2url

v1.0.15

Published

Converts image to url using discord.js

Downloads

385

Readme

About The Project

Convert images to urls using discord bot / imgbb api

  • How it works For discord: Images are sent to a discord channel that you specify. The bot will then get the proxy url of the image and then return it to you.

For imgbb: Images are sent to imgbb database and then the url is returned to you.

Getting Started

For Discord

  1. Make a discord bot in discord developer portal
  2. Copy the token and paste it in the .env file named DISCORD_TOKEN
  3. Invite the bot to your server
  4. Get the channel id of the channel where you want to send the images
  5. Paste the channel id in the .env file named DISCORD_CHANNEL
  6. Check env_example file for more info - env_example
  7. Install the required packages - discord.js, dotenv, fs
  8. Install image2url using npm
    npm install image2url
  9. Require the package in your main file
    const image2url = require('image2url');

For Imgbb

  1. Make an account on imgbb
  2. Get the api key from the dashboard
  3. Paste the api key in the .env file named IMG_BB_KEY
  4. Install the required packages - axios, dotenv, fs, form-data

Functions


// Discord upload

image2url.init({
    token: process.env.DISCORD_TOKEN,
    channel: process.env.DISCORD_CHANNEL
});

image2url.upload('tests/kurizu.jpg', 'kurizu pfp').then(url => {
    console.log(url);
});


// Imgbb upload
const imagePath = 'tests/kurizu.jpg';

image2url.imgbb_upload(imagePath, process.env.IMG_BB_KEY)
    .then((url) => {
        console.log('Image uploaded successfully. URL:', url);
    })
    .catch((error) => {
        console.error('Image upload failed with error:', error);
    });

Check env_example file for more info - env_example

Usage

const image2url = require('image2url');
require('dotenv').config()

// Discord upload

image2url.init({
    token: process.env.DISCORD_TOKEN,
    channel: process.env.DISCORD_CHANNEL
});

image2url.upload('tests/kurizu.jpg', 'kurizu pfp').then(url => {
    console.log(url);
});


// Imgbb upload
const imagePath = 'tests/kurizu.jpg';

image2url.imgbb_upload(imagePath, process.env.IMG_BB_KEY)
    .then((url) => {
        console.log('Image uploaded successfully. URL:', url);
    })
    .catch((error) => {
        console.error('Image upload failed with error:', error);
    });

Note:

  1. tests/kurizu.jpg is the path to the image you want to send.
  2. kurizu pfp is the name of the image.
  3. The url will have the name that you specified. which in this case is kurizu pfp.

For more information on how to use it visit

Roadmap

  • [ ] Add Changelog
  • [ ] Add Tests
  • [ ] Add Additional Templates w/ Examples
  • [ ] Add Support for more image formats
  • [ ] Documentation
    • [ ] Website
    • [ ] Examples
    • [ ] Wiki
  • [ ] Add Support for more platforms

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Package Made by: kurizu.taz on discord Github - https://github.com/crizmo/image2url