aerouk / imageserve Goto Github PK
View Code? Open in Web Editor NEWA ShareX image hosting solution for your own domain.
Home Page: https://iaero.me/imageserve
License: GNU General Public License v2.0
A ShareX image hosting solution for your own domain.
Home Page: https://iaero.me/imageserve
License: GNU General Public License v2.0
I was having an error viewing jpegs with the viewer. I fixed it tho.
Replace your viewer.php with this
<?php
require_once(__DIR__ . '/protected/config/config.php');
$index = ! (isset($_GET['type']) && isset($_GET['file']));
if ($index) {
include_once(__DIR__ . '/protected/templates/index.phtml');
die();
}
$type = $_GET['type'];
$file = $_GET['file'];
if ($type == "jpeg") {
$stype = "jpg";
} else {
$stype = $type;
}
$filelocation = __DIR__ . "/images/$type/$file.$stype";
if ( ! file_exists($filelocation)) {
header("HTTP/1.0 404 Not Found");
include_once(__DIR__ . '/protected/templates/error.phtml');
die();
}
$filesize = filesize($filelocation);
if (RAW_IMAGE) {
$filecontents = fopen($filelocation, 'rb');
header("Content-type: image/$stype");
header("Content-length: " . $filesize);
fpassthru($filecontents);
exit;
} else {
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
require_once(__DIR__ . '/protected/templates/viewer.phtml');
}
here sample for nginx config
autoindex on;
location / {
try_files $uri $uri/ =404;
rewrite ^/?$ /viewer.php;
rewrite ^/([^/\.]+).gif/?$ /viewer.php?type=gif&file=$1;
rewrite ^/([^/\.]+)(.jpg|.jpeg)/?$ /viewer.php?type=jpeg&file=$1;
rewrite ^/([^/\.]+)(.png)?/?$ /viewer.php?type=png&file=$1;
}
location /g {
rewrite ^/g/([^/\.]+)(.gif)?/?$ /viewer.php?type=gif&file=$1;
}
location /j {
rewrite ^/j/([^/\.]+)(.jpg|.jpeg)?/?$ /viewer.php?type=jpeg&file=$1;
}
location /w {
rewrite ^/w/([^/\.]+)(.webm)?/?$ /viewer.php?type=webm&file=$1;
}
Hi there. I followed the video tutorial but I get the following error:
Error: Message:
The remote server returned an error: (405) Method Not Allowed.
Request URL:
https://memes.slimshadyime.me/imageserve/upload.php
Response:
<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>
Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at ShareX.UploadersLib.Uploader.SendRequestFile(String url, Stream data, String fileName, String fileFormName, Dictionary`2 args, NameValueCollection headers, CookieCollection cookies, ResponseType responseType, HttpMethod method, String contentType, String metadata)
ps help
For some reason, when I upload images, the larger ones seem to be uploading and returning a /j/imagename address while not actually creating a /j folder or anything.
They used to just upload as i.domain.com/xxxxxx.jpg and worked just fine. Now it's adding a /j/ and messing everything up, causing 404s.
I haven't changed anything whatsoever. Just started happening one day with larger images.
Hey there, is there a easy way for not renaming the files that got uploaded, i mean my share x already apply a timestamp, so there should be no dublicates possible, and i want to sort the images after.
@aerouk
Simply doesn't work, I followed all video instructions. My config is
`<?php
// _
// () A self-hosted ShareX image serving solution.
// _ _ __ ___ __ _ __ _ ___ ___ ___ _ ____ _____
// | | ' _ \ / _
|/ ` |/ _ / |/ _ \ '\ \ / / _
// | | | | | | | (| | (| | _/_ \ __/ | \ V / __/
// ||| || ||_,|_, |_||/_|_| _/ _|
// / |
// |/ created by github.com/aerouk
/* More information on all these values can be found on the wiki page. /
/ https://github.com/aerouk/imageserve/wiki/Configuration */
define('RAW_IMAGE', true);
define('RAW_IMAGE_LINK', false);
define('IMAGE_EXTENSION', false);
define('TWITTER_CARDS', false);
// If you're using this, make sure to put a forward slash before.
// E.g. "/imageserve" not "imageserve"
define('IMAGESERVE_DIR', '/images');
define('TWITTER_HANDLE', '');
define('APP_NAME', 'My App');
define('PASSKEY', 'removed');
`
I haven't tested this with Apache, but using IIS, when I turn RAW_IMAGE_LINK to "false" and allow the URL shortener to work, the resulting shortened URL just returns a 404 page. However, when RAW_IMAGE_LINK is "true" and no URL shortener is used, the URL obtained in ShareX works just fine.
Am I missing something here, or is something in the source not properly shortening URLs?
The files are saving to my webserver fine but when I take a screenshot it is just redirecting me to my domain/php without the image name.
When I test, it doesn't give me any error, just when I click the link, nothing comes up.
Something like: https://domain.com/๐?=h37xj
Hey,
It seems as if my .htaccess file is not doing anything, when I go to the direct file path it works just fine (http://website.com/images/png/image.png/) but when I go to http://website.com/image/ it does nothing and just says "Not Found".
Do you know what might be wrong? Thanks!
I have set the permissions on /images/ and .htaccess to 777.
Does anyone have a fix for this? Thanks!
Is it possible to have support for other files as well? Like zip or txt? That would be really useful.
I still get the e-500x error but the directories are all writable (777)
Make them look nicer, damn it.
Hi, just want to let you and others know that there has now been a change in how regex is used within ShareX, meaning that in the URL box of the custom uploader configuration it needs to be changed from:
http://yourwebsite.extension/$1$ to http://yourwebsite.extension/$regex:1$
Not doing this means that responses will show correctly, but they will be translated into urls that are simply http://yourwebsite.extension without a link to the image.
Thanks!
I'm getting this error: https://i.imgur.com/jQQnKh6.png
I know for sure that all my info is correct. I'm using infinity host and my directory structure goes as follows: https://i.imgur.com/PGbVbu8.png
Not sure what is causing this but any help would be appreciated.
Thanks
I followed the steps exactly to use webm on my server, yet I just get this as the url 'https://i.theapollo.xyz/e-415'
I dont know whats happening, I copied the steps exactly, and my images work aswell
This started happening after the newest ShareX update (11.4.1)
Images uploaded with Imageserve throw an error if you're attempting to upload via HTTPS. HTTP works fine.
I'm a huge noob.
I put imageserve into a folder named 'imageserve-demo'. This is what happens when I use the test button on ShareX: http://i.william.sh/imageserve-demo/wY4xg
I get a 404 error. I have a feeling this is a very simple fix, and that I am just either a huge noob, or just really tired.
My /images is set to 0777 in WinSCP.
I can provide any files (such as my config.php) if needed.
Thank you! I would like to get this resolved as soon as possible. ๐
Can I remove the /w/, /g/, or /j/ from the url? Not the raw link, but this kind: https://demihypercube.space/i/g/4tCGS
Hi all, I just did a fresh install of the latest revision, and im getting this error
Message:
Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
StackTrace:
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at UploadersLib.Uploader.TransferData(Stream dataStream, Stream requestStream)
at UploadersLib.Uploader.UploadData(Stream dataStream, String url, String fileName, String fileFormName, Dictionary`2 arguments, NameValueCollection headers, CookieCollection cookies, ResponseType responseType, HttpMethod method)
does this imply that my previous attempt to install still has the connection open? o.o
app/
and public/
directoriesI'm the one who emailed you about the image extension being appended to the raw image link by default. You told me to make an issue and here it is. ๐
I've set up your script on a server running PHP 5.6. I get success returned to ShareX but when I try to go to the image there's nothing there. I've checked the images directory and there's nothing in there either. All of the directories are set to 777.
If you add this line of code to your upload.php you can just delete the folder in the image folder.
And then it will make the png/gif/jpg folders by itself. I think you should really implement this :)
if (!file_exists("/" . $dir . "/" . $type . "/")) { mkdir($dir . "/" . $type, 0777); }
I noticed you didn't also get an image showing up until you changed the permissions to 777 and also recursive thing and after I did that I still do not see any images appear. What might be wrong?
When I go to the home page of my domain, it shows nothing but a blank page, when I got to the viewer.php, it just shows the homepage and even says it is the homepage in the title. Any idea on how to fix this?
Hi there. I'm @aspiegeek on Twitter and I wasn't sure how to make a pull request (tells me there's nothing to compare and I don't have anything on here) and so this would work better imo. I'm also the one who suggested the raw image link suggestion from May.
Anyway, I'd like to suggest a way to remove the /j/ and /g/ from the raw image link so no matter what type of file it is, it'll always be domain.tld/abc123.xyz rather than /j/abc123.xyz or /g/abc123.xyz. I find it very annoying when I'm uploading and sharing with those two directories.
title
I am still getting an e-500x error, even after setting the permissions. Could SSH keys have something to do with it?
I have everything up and running fine, png and gif uploads go without a hitch, but jpg uploads have been acting weird. First I was getting e-503 for jpgs, despite all permissions being fine. I renamed the image/jpeg folder to image/jpg and they upload successfully now but result in a 404 when trying to view.
Tried replacing my upload.php with the replacement from addles' earlier issue, both with the folder name image/jpeg and image/jpg, and received the same results.
So im trying to set this up with Apache2 and I keep getting an e-503 as the url. Any idea what the problem is?
I dont want my jpeg images going to a seperate folder, '/j/2kdl7' I want it to be like my PNG files, where it will only goto to the index page, for example 'https://theapollo.xyz/foLyQ'.
Is there a way to make the jpegs not go into the '/j' dir?
I set all up and it outputs:
URL: http://tism.io/h/4000);</script>
If you were to add Text file support that would be great, thanks!
I've triple checked my password and I'm still getting E-401. Here's my ShareX config:
And here's my config.php:
// _
// (_) A self-hosted ShareX image serving solution.
// _ _ __ ___ __ _ __ _ ___ ___ ___ _ ____ _____
// | | '_ ` _ \ / _` |/ _` |/ _ \/ __|/ _ \ '__\ \ / / _ \
// | | | | | | | (_| | (_| | __/\__ \ __/ | \ V / __/
// |_|_| |_| |_|\__,_|\__, |\___||___/\___|_| \_/ \___|
// __/ |
// |___/ created by github.com/aerouk
/* More information on all these values can be found on the wiki page. */
/* https://github.com/aerouk/imageserve/wiki/Configuration */
define('RAW_IMAGE', false);
define('RAW_IMAGE_LINK', false);
define('IMAGE_EXTENSION', false);
define('TWITTER_CARDS', false);
// If you're using this, make sure to put a forward slash before.
// E.g. "/imageserve" not "imageserve"
define('IMAGESERVE_DIR', '/');
define('TWITTER_HANDLE', '');
define('APP_NAME', 'RYXN');
define('PASSKEY', "<REDACTED>");```
Any ideas?
Hello i dont know if you are still working on this project but i would really like if you can add a login page to view images and manage them it would be really cool
I entered everything in this picture found on the wiki page (https://camo.githubusercontent.com/5d6300a55c1118163d18f509d13a4828fc6563fe/687474703a2f2f696165726f2e6d652f692f4d75507841), but when I test the image uploader i'm left with "URL: https://i.speed.wtf/e-401". Not sure what other things I need to show you, but I followed the video and this is all i'm getting. Any way to fix this?
When creating a screenshot sharex will report it was in the /img directory but is actually in the /img/images/png, gif etc. This really annoys me as i have to find out what filename it is from the server itself.
So i was trying to use a custom uploader and such and i'm getting this error
please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
How do i fix this?
My default browser has javascript enabled and my other browsers i have installed.
Can we get an updated tutorial? We're now on ShareX 13.1 and things have changed.
upon upload, sharex does seemingly nothing and the preview when clicked directs me to my urls initial webpage, there is no error when i test it, my config and destination settings are in line with setup, and I have written my permissions recursively (albeit on many folders, perhaps this is my issue) i would really love some help with this, i will post a video.
Hey,
it kinda looks like the viewer is fucked up. I can make Screenshots and I can test the image uploader, but it keeps saying that the requested URL wasnt found on the server.
However the Pictures itself get uploaded and can also be viewed with the complete URL.
Example:
Not working:
https://cleanlegen.de/i/FeK5D
Working:
https://cleanlegen.de/i/images/png/FeK5D.png
Any Idea how to fix?
Here are my Settings:
`<?php
// _
// () A self-hosted ShareX image serving solution.
// _ _ __ ___ __ _ __ _ ___ ___ ___ _ ____ _____
// | | ' _ \ / _
|/ ` |/ _ / |/ _ \ '\ \ / / _
// | | | | | | | (| | (| | _/_ \ __/ | \ V / __/
// ||| || ||_,|_, |_||/_|_| _/ _|
// / |
// |/ created by github.com/aerouk
/* More information on all these values can be found on the wiki page. /
/ https://github.com/aerouk/imageserve/wiki/Configuration */
define('RAW_IMAGE', true);
define('RAW_IMAGE_LINK', false);
define('IMAGE_EXTENSION', false);
define('TWITTER_CARDS', false);
// If you're using this, make sure to put a forward slash before.
// E.g. "/imageserve" not "imageserve"
define('IMAGESERVE_DIR', '/i');
define('TWITTER_HANDLE', '@Electricz_y0');
define('APP_NAME', 'imageserve');
define('PASSKEY', 'dummerhurensohn124323bhj12nn');
`
ShareX:
https://cleanlegen.de/i/images/png/xdC7r.png
I am using cloudflare, but i dont think that this is the problem
Thanks in advance
-snip-
To be able to send videos recorded in sharex to imageserve
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.