Minecraft Mods

[1.12.2] [Forge] Screenshot Uploader V1.1.0

  • 4,150 views, 2 today
  • 183 downloads, 0 today
  • 11
  • 9
  • 4
DarkEyeDragon's Avatar DarkEyeDragon
Level 52 : Grandmaster Programmer
124

ScreenshotUploader


Minecraft forge mod that does exactly as it name indicates. Upload screenshots.

Default keys:

  • F4 Upload image
  • F2 Save and upload image (override has to be enabled to upload)

Features:

  • Direct upload to imgur
  • Copy link to clipboard (configurable)
  • Upload to your own server

Planned features:

  • Add custom server support to upload to your own server
  • Filters
  • Overlays/watermarks

Changing settings

  • you can change your settings by going to mods on the main menu or by going to mod options in the in-game menu.

Uploading to a custom server


Once you've gotten to mod settings there will be a "Server settings" button

You can click here if you want a better formatted example (on github)

Client configuration


Link: link to the upload script Post values: add POST data to your request for servers that require some form of authentication. everything before = is considered as the key and everything after as value you can get the key like this in PHP for example: $_POST["key"] and that would return the value NOTE: {image} is required as this will send the image data. However you can choose whatever key you want. NOTE: dont use spaces between ´=´ they will be added.

Example:

image={image} //send post data with image as key and {image} as value
key=2DAC1D297E6E7E348E5CE1884A7FC //send post data with key as key and 2DAC1D297E6E7E348E5CE1884A7FC as value

if you are using some image hosting service make sure to look up what data you need to send. If you use your own upload script you can pretty much do whatever you want.
Server configuration PHP

NOTE: PLEASE for the love of your own sanity, USE VALIDATION or anyone could upload anything to your server NOTE: I will assume you have at least basic knowlege about PHP. This is a VERY basic example. With very little security to keep it fairly simple and straight forward. you can read https://security.stackexchange.com/questions/32852/risks-of-a-php-image-upload-form to find out more about security

Make sure to change the $key dont use the one given here.
[code]
<?php
/**
* Created by PhpStorm.
* User: DarkEyeDragon
* Date: 4-4-2018
* Time: 03:21
*/

$key = "2DAC1D297E6E7E348E5CE1884A7FC"; //this can be anything, just make sure its the same as the one you set in the client

if(isset($_FILES["image"])){ //check if there is a key named image
if($_POST["key"] === $key) {
$target_dir = "images/"; //directory to upload to (MUST EXIST!)
$file_name = str_replace(".", "-", uniqid("img", false)); //get an unique id
$target_file = $target_dir . basename($file_name . ".jpg"); //add the extention

$fp = fopen('log.txt', 'a'); //create a file
fwrite($fp, $_FILES["image"]); //write image data to the file to see if it comes in correctly

if (move_uploaded_file($_FILES["screenshot"]["tmp_name"], $target_file)) {
fwrite($fp, "The file " . basename($_FILES["screenshot"]["name"]) . " has been uploaded.");
header("Location: $_SERVER[HTTP_HOST]/$target_file"); //send the url to the image back to the client
} else {
fwrite($fp, "Sorry, there was an error uploading your file.");
http_response_code (500); //send an internal error back
}
}else{
http_response_code (401); //send unauthorized error back
}
}
else
http_response_code (400); //send and invalid request error back
[code][/code]
CreditImgur for providing the API
Progress95% complete
Game VersionMinecraft 1.12.2
Tags

1 Update Logs

Update #1 : by DarkEyeDragon 04/10/2018 12:55:07 pmApr 10th, 2018

1.1.0:
- Added support for custom servers
- Added language support
- cleaned up code

Create an account or sign in to comment.

2
05/14/2019 11:54 am
Level 15 : Journeyman Engineer
RedstoneFuture
RedstoneFuture's Avatar
The planned feature "custom server support to upload to your own server" would be really great!
1
08/15/2019 10:02 am
Level 52 : Grandmaster Programmer
DarkEyeDragon
DarkEyeDragon's Avatar
This mod has been moved to curse. https://www.curseforge.com/minecraft/mc-mods/image-utils
That version supports custom upload servers
1
04/14/2018 4:21 pm
Level 35 : Artisan Engineer
Mister_Fixx
Mister_Fixx's Avatar
Great mod, helps me share screenshot of noobs faster. 10/10 for dankness, 10/10 for usability, 2/10 for the dev, dev is gay.
1
04/14/2018 4:23 pm
Level 52 : Grandmaster Programmer
DarkEyeDragon
DarkEyeDragon's Avatar
less than 3
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome