News for hackers. Stuff that matters.
Re:IMGZ – Paid image sharing by statico on Monday September 27, 2021 @06:10PM (#28676654)
I've been hoping for an Imgur replacement for simple, hosted image sharing.

I'm happy to pay $1/mo, but when I tried to upload https://camo.githubusercontent.com/9ec8d13de2878c899fda0bd43... I got this, which doesn't look like what I uploaded: https://cln.sh/4coS9T / https://imgz.org/i5qphFzd.gif

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @06:10PM (#28676665)
Well that's extremely odd, I will look into that right now.

EDIT: This is very odd, I'm not really doing any processing on the uploaded files, so it should definitely return the originals. I will have this fixed soon though.

EDIT2: Unfortunately, the saved image in the DB itself is corrupt, so you will need to reupload after I solve this.

EDIT3: Alright this should be fixed! Now I can start submitting animated GIFs there.

EDIT4: Ironically, now ONLY animated GIFs work, because 2am is when I do some of my best work. Stand by...

Re:IMGZ – Paid image sharing by jpomykala on Monday September 27, 2021 @06:27PM (#28676838)
You said, no support. Why do you even care? F*k this guy. Delete his account. /s
Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @06:40PM (#28676980)
Hey, I use this thing, it has to work.
Re:IMGZ – Paid image sharing by jrs235 on Monday September 27, 2021 @09:07PM (#28678130)
It only has to work for you! Did/do you need/use animated gifs?
Re:IMGZ – Paid image sharing by stavros on Tuesday September 28, 2021 @03:52AM (#28680311)
Don't tell me what to do! I want to fix animated gifs and I'll fix animated gifs!
Re:IMGZ – Paid image sharing by brianshaler on Tuesday September 28, 2021 @07:20AM (#28681472)
Per the edits on your previous posts, I read this more as "and I'll pivot to only supporting animated gifs!"
Re:IMGZ – Paid image sharing by stavros on Tuesday September 28, 2021 @07:40AM (#28681618)
I can't say I didn't consider it...
Re:IMGZ – Paid image sharing by mnsc on Friday October 01, 2021 @05:12AM (#28716215)
Any picture can be an animated gif with one frame and a duration of 50 years which should do for this civilization.
Re:IMGZ – Paid image sharing by ackbar03 on Tuesday September 28, 2021 @03:39AM (#28680263)
yea fk tht guy
Re:IMGZ – Paid image sharing by 6510 on Tuesday September 28, 2021 @08:56AM (#28682186)
Fast support.
Re:IMGZ – Paid image sharing by pkulak on Monday September 27, 2021 @06:41PM (#28676995)
> saved image in the DB

Whoa now... you're putting images in the database?

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @06:50PM (#28677089)
Yes, it's a database. That's where you're meant to put DATA.
Re:IMGZ – Paid image sharing by jasode on Monday September 27, 2021 @06:58PM (#28677167)
>Yes, it's a database. That's where you're meant to put DATA.

Most (all?) large-scale high-volume image storage architectures I'm aware of do not store billions of images as blobs in a database. Instead, they typically store the images as files. The database only holding metadata info and a pointer to the image filename location (or url if using AWS S3 or CDN).

E.g. Facebook is one of the largest MySQL sites (if not the largest) and they don't store photos directly in MySQL.

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @07:08PM (#28677249)
I'm joking, but the volume for IMGZ is way too low (and always will be) for data storage to matter.
Re:IMGZ – Paid image sharing by jamesjyu on Monday September 27, 2021 @08:24PM (#28677852)
Still low even after HN surge?
Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @08:27PM (#28677877)
Let me check...

TWO more images were added today! At this rate, I'm going to need to buy a whole datacenter by next week.

https://imgz.org/blog/2020/12/23/haha-suckers/

Re:IMGZ – Paid image sharing by ryan-allen on Monday September 27, 2021 @11:50PM (#28679132)
I like you (and I like storing images in the database).

EDIT: I uploaded an image into your database https://imgz.org/i3joC5jC/

Re:IMGZ – Paid image sharing by stavros on Tuesday September 28, 2021 @12:15PM (#28684472)
That is an excellent image, worthy of gracing my database.
Re:IMGZ – Paid image sharing by toomuchtodo on Tuesday September 28, 2021 @09:19AM (#28682406)
Majestic Taco.
Re:IMGZ – Paid image sharing by gauravjain13 on Monday September 27, 2021 @08:46PM (#28677998)
Don't knock exponential growth!
Re:IMGZ – Paid image sharing by matkoniecz on Tuesday September 28, 2021 @07:37AM (#28681594)
BTW, https://imgz.org/i9xyk2H2.png is broken and included prominently in https://imgz.org/blog/2020/12/23/haha-suckers/

Not sure is it some intentional irony or an actual bug.

Re:IMGZ – Paid image sharing by stavros on Tuesday September 28, 2021 @07:41AM (#28681621)
Re:IMGZ – Paid image sharing by 6510 on Tuesday September 28, 2021 @09:04AM (#28682264)
Ill take the job.
Re:IMGZ – Paid image sharing by jrochkind1 on Monday September 27, 2021 @09:44PM (#28678359)
I understand that postgres is pretty decent at storing large binary data though?

I've been meaning to investigate trying storing images in postgres on a hobby web project where it could be convenient; I'd still want to make sure I was streaming bytes from postgres to the client, not loading the whole image into memory and only once fully loaded sending it to the client. Looking at the pg API's for my language/platform of choice, it looked at least plausible to do this with a BLOB.

Re:IMGZ – Paid image sharing by yarcob on Tuesday September 28, 2021 @05:02AM (#28680664)
> I understand that postgres is pretty decent at storing large binary data though?

Storing large files in PostgreSQL is possible, but I would advise against it.

PostgreSQL uses a technique called TOAST to store large objects. If you store something in a bytea column, it'll first be compressed (either deflate or a new algorithm that I forgot the name). Then it will be split into 8KB chunks (page size) and stored together with all the other data.

Since most image formats are already compressed, this just wastes a lot of CPU cycles.

Also, the way storage is allocated in PostgreSQL may bite you in the ass. By default, storage is not returned to the OS. If you delete all images, the data will stay on disk and marked as reusable. Only if you do a full rewrite of the table will the free space be made available again.

Also, backups will become a pain. The easiest way to backup PostgreSQL servers is to just do a pg_dump. It works great up to a few gigabytes of data. If you have images or other large objects in the database, then pg_dump will quickly become unfeasible and you will have to find another way to do backups. Not a deal breaker, but something you should be aware.

Also, for best performance, the database should be on fast storage (eg. NVME SSD), whereas the image data typically doesn't need fast storage.

## A Practical Example:

One project I work on is an image database with 50k images. The high resolution previews are around 20GB. The PostgreSQL database with all the metadata is around 20MB.

It takes 10 seconds to do a full backup of the database. Everytime I change something in the application, I first create a dump of the database (which is just a few MB compressed). Then I do my changes, and if I make a mistake I always have a backup that I could restore in 10 seconds.

If the images were stored in the PostgreSQL database, a full backup would take much longer and would require a fast internet connection. And it would be much harder to work with.

My recommendation: Use the filesystem for storing files.

Re:IMGZ – Paid image sharing by jrochkind1 on Tuesday September 28, 2021 @08:56AM (#28682191)
Thanks for info! What about binary large objects instead of bytea?

Size/speed of backups is a good point to consider.

Re:IMGZ – Paid image sharing by yarcob on Tuesday September 28, 2021 @10:34AM (#28683281)
I've never used PostgreSQLs large objects. You have to use this awkward API to use them, they aren't stored efficiently either, and as far as I can tell it's just a legacy feature that nobody has bothered to deprecate yet.

In my opinion the only neat thing about large objects is that you can edit files with a posix-like API in a database transaction, but I can't think of a scenario where that would actually be useful.

Re:IMGZ – Paid image sharing by Arnt on Tuesday September 28, 2021 @03:23AM (#28680181)
Postgres is indeed good at that. I know from experience.

If you want to commit ten things every second all week, don't transfer so much data in a single transaction that you hold any important locks for half a minute. And if you use replication, test while replicating.

If the blobs you store are small enough to not disturb your commit rate, then pg's drawbacks are IMO smaller than those of the alternatives, particularly if you want some sort of commit that returns when both image data and something else have been committed.

Re:IMGZ – Paid image sharing by jrochkind1 on Tuesday September 28, 2021 @08:57AM (#28682197)
Thanks for info!

So you've stored images in the db in production and had it work out fine?

I don't want to commit ten things a second. It would be a pretty read-heavy write-light load. Sounds like that would avoid one path of riskiness at least.

Re:IMGZ – Paid image sharing by Arnt on Tuesday September 28, 2021 @11:33AM (#28684023)
Yes, exactly.

Many people answer a question like this: "How good is postgres at storing big blobs, relative to small things?" Postgres is indeed worse at storing large things. However, I think the most interesting question is something along these lines: "What's best, storing everything in Postgres and accepting that inefficiency for the big blobs, or implementing transactions, replication and/or backup with a part of the data in Postgres and the big blobs elsewhere?"

I'm awfully fond of having working backups, and postgres' performance problems with the blobs haven't been big enough that I've really noticed.

Re:IMGZ – Paid image sharing by tinus_hn on Tuesday September 28, 2021 @04:12AM (#28680400)
Does it still require a backup/restore cycle for upgrades? That could be an issue.
Re:IMGZ – Paid image sharing by yarcob on Wednesday September 29, 2021 @02:08AM (#28690755)
Yeah, that hasn't changed. You can also use the pg_upgrade script instead of a full backup/restore, or use logical replication if you want to upgrade the db server with zero downtime, but upgrading PostgreSQL is still somewhat annoying.
Re:IMGZ – Paid image sharing by Arnt on Tuesday September 28, 2021 @03:17AM (#28680149)
I too do that, in a different context, and it's fine. Databases have problems with big items, but images aren't big in that sense nowadays.

The problems relate mostly to backups/copies/reloads, that kind of thing, and copying an image doesn't cause anything to hiccup. A transaction that transferred 1MB over a modem line was a problem, that could block other commits for a long time, on today's networks 1MB doesn't take long.

Re:IMGZ – Paid image sharing by dijit on Monday September 27, 2021 @07:03PM (#28677204)
... depending on the type of data.

Binary data in databases is usually not a great idea, but tolerable in low amounts.

I can't imagine storing images in a database, you're probably better off with a document store.

Relational Databases (well, the ones that I know the internals of) tend to have soft limits on row sizes, in PostgreSQL this is 8kb (which is very small for an image); to overcome this limitation Postgres uses what they call a TOAST table, which forces compression by default, which absolutely crumbles on binary data.

https://www.postgresql.org/docs/13/storage-toast.html

But, if it works, I'm not complaining- and I'm very certain that other such sites have worse architectural flaws in the beginning- this one is pretty easy to overcome if it becomes an issue and can be alleviated with aggressive caching of CDNs/varnish to buy you time if there's immediate issues. :)

Re:IMGZ – Paid image sharing by sverhagen on Monday September 27, 2021 @07:28PM (#28677411)
If you were to go with PostgreSQL, wouldn't you store this in a large object, which is effectively stored outside of the actual table row? So, if you can store enough rows of meta data AND you provision enough storage, why wouldn't the database be able to do this. I don't imagine you want to put a primary key on the actual image data column (not possible with large objects, since the column just contains an "oid"). I'm not arguing for storing images in the database, I've seen it done either way, and done it myself either way, but I believe that it's an ongoing source of heated debate between proponents and opponents. I.e. not settled out of hand.
Re:IMGZ – Paid image sharing by dijit on Monday September 27, 2021 @08:14PM (#28677772)
Large objects are _mostly_ an access method, the underlying implementation is staggeringly similar to TOAST.

> The large object implementation breaks large objects up into “chunks” and stores the chunks in rows in the database. A B-tree index guarantees fast searches for the correct chunk number when doing random access reads and writes.

You might try Foreign Data Wrapping.

In which case I still wouldn't because the database is going to be spending more time in doing round trips, better my application server does that, there's usually more of them.

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @08:15PM (#28677779)
This entire comment is accurate. I chose the DB for ease of backups more than anything.
Re:IMGZ – Paid image sharing by debarshri on Monday September 27, 2021 @06:57PM (#28677157)
How about filesystem or object storage? That where you meant to put a FILE which is what the user uploaded.
Re:IMGZ – Paid image sharing by dsr_ on Monday September 27, 2021 @08:14PM (#28677773)
If IMGZ was a file sharing service it would be called FILZ or something. Obviously this is not that.
Re:IMGZ – Paid image sharing by noobgrammer on Monday September 27, 2021 @08:25PM (#28677865)
And if it were a hotel it could just be called ZZZ.
Re:IMGZ – Paid image sharing by jagged-chisel on Monday September 27, 2021 @06:53PM (#28677120)
Advice these days is to rely on the database to do the right thing with your uploaded files. I think they all handle this rather well.
Re:IMGZ – Paid image sharing by pkulak on Tuesday September 28, 2021 @12:19AM (#28679298)
That sounds right. But even if it works great, it's gonna be the most expensive place to put your data. Those image blobs would be fine on spinning rust.

But yes, there's probably time for that optimization later, if the service takes off.

Re:IMGZ – Paid image sharing by emfax on Monday September 27, 2021 @07:30PM (#28677431)
Doesn't iCloud use FoundationDB for storage of files?
Re:IMGZ – Paid image sharing by LegitShady on Monday September 27, 2021 @06:56PM (#28677149)
say hello to my friend BLOB
Re:IMGZ – Paid image sharing by silisili on Monday September 27, 2021 @06:18PM (#28676749)
Same for me. I tried uploading this test image - https://bhi61nm2cr3mkdgk1dtaov18-wpengine.netdna-ssl.com/wp-... (dont ask, lol)

and the uploaded image was a negative of it.

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @06:22PM (#28676799)
That one worked for me: https://imgz.org/i4mdbiQL.jpg
Re:IMGZ – Paid image sharing by silisili on Monday September 27, 2021 @06:26PM (#28676828)
Sorry I may have been dishonest there. I downloaded it from the google search results directly, perhaps this link- https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTFsEM5...

it resulted in https://imgz.org/i5Q2gzwB.png

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @06:40PM (#28676985)
Hm, very odd that the type wasn't detected properly. The animated GIF issue is because of EXIF stripping ruining the image, though. I'm fixing that now.
Re:IMGZ – Paid image sharing by sverhagen on Monday September 27, 2021 @07:30PM (#28677435)
It seems like you're still dealing with some pretty rudimentary issues here.
Re:IMGZ – Paid image sharing by sieabah on Monday September 27, 2021 @07:46PM (#28677560)
He threw it together in 2 days according to what's written on the website.

It literally has no semblance of trying to be a long term long running replacement to imgur. Just a dead simple image upload service that works from the CLI.

Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @08:16PM (#28677789)
I did throw it together in two days, two years ago! I don't know why this image failed, when I tried it it worked. Animated GIFs were failing because I don't use them so I'd never tested on them. It's fixed now, though.
Re:IMGZ – Paid image sharing by romwell on Monday September 27, 2021 @06:21PM (#28676794)
>I've been hoping for an Imgur replacement for simple, hosted image sharing.

If you are willing to pay for things, then any good old web host + FTP are your friends.

Re:IMGZ – Paid image sharing by statico on Monday September 27, 2021 @06:30PM (#28676867)
That sounds like a lot of work. Why not just push my screenshots to good ol' NNTP?
Re:IMGZ – Paid image sharing by Jaruzel on Tuesday September 28, 2021 @03:37AM (#28680253)
Because downloading a tiny GIF in 20 parts, is always fun. /s
Re:IMGZ – Paid image sharing by tinus_hn on Tuesday September 28, 2021 @04:14AM (#28680410)
And it’s only accessible for paying users for about a year, slightly more or less according to how much they pay and how much is uploaded by the rest of the internet…
Re:IMGZ – Paid image sharing by jrochkind1 on Tuesday September 28, 2021 @10:09AM (#28682964)
That sounds really out-dated. Why not put the screenshots on a blockchain?
Re:IMGZ – Paid image sharing by aabbcc1241 on Monday September 27, 2021 @08:33PM (#28677924)
Or ipfs if your machine is often online
Re:IMGZ – Paid image sharing by romwell on Tuesday September 28, 2021 @12:40PM (#28684751)
Again, straight up running an FTP server on your machine is still the easiest way to transfer large files.

Also faster than uploading to the cloud, and then having the other party download it.

Re:IMGZ – Paid image sharing by woko on Tuesday September 28, 2021 @02:12PM (#28685729)
There is ImgBB. You need to create an account, but it is free.

https://imgbb.com/

Re:IMGZ – Paid image sharing by theawless on Monday September 27, 2021 @06:17PM (#28676735)
Nightmare fuel
Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @06:21PM (#28676784)
This is hereby declared a feature.
Re:IMGZ – Paid image sharing by yobert on Monday September 27, 2021 @06:34PM (#28676915)
Bug? Or feature?
Re:IMGZ – Paid image sharing by iab on Monday September 27, 2021 @08:29PM (#28677889)
Mint that NFT RIGHT NOW
Re:IMGZ – Paid image sharing by stavros on Monday September 27, 2021 @08:31PM (#28677907)
IMGZ created this, IMGZ owns the copyright. IMGZ has a will of its own.