1.0.15 • Published 2 months ago

image2url v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

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
  1. 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

1.0.15

2 months ago

1.0.14

2 months ago

1.0.13

10 months ago

1.0.12

11 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago