<FromGitter>
... crystal to get the bytes and save it as a image (png, jpg, jpeg). basically uploading an image and for crystal to save the file when it has all the bytes. i'm at the point where crystal has all the bytes (socket.peek) displays them. but i need to convert these bytes to an image. that i don't know how to do. ⏎ ⏎ for exam ... [https://gitter.im/crystal-lang/crystal?at=5c59235cc2dba5382ee20ae3]
<FromGitter>
<kingsleyh> I can’t read all the code in gitter as it gets cut off - but did you try socket.read_fully
<FromGitter>
<kingsleyh> Then String.new(the_bytes)
<FromGitter>
<kingsleyh> @girng
<FromGitter>
<girng> kk trying now
<FromGitter>
<girng> OMG LMAO
<FromGitter>
<girng> @kingsleyh that was the biggest fail I think i ever did in my entire life. i was using the `get_data()` from https://docs.godotengine.org/uk/latest/classes/class_image.html which returns *Returns the image’s raw data.*. This is not the same as the CONTENTS of the image *file* itself.
<FromGitter>
<girng> so i did `file.get_buffer(file.get_len())` instead of the `get_data()` on the image texture, and boom: uploaded it through crystal's stream PERFECTLY
<FromGitter>
<girng> Gosh i love crystal makes it so freaking easy. was having so many problems with godot's dumb http client crap
<FromGitter>
<girng> so instead of an http request, i just piped those bytes through a tcp stream LOL 😆
<FromGitter>
<kingsleyh> Nice!
<FromGitter>
<kingsleyh> Hmm from the docs it does look like it should contain the image data as bytes in a PoolByteArray - so if it’s not enough to materialise the image then that’s very misleading!
<FromGitter>
<girng> yeah, it's weird, def different data lol
<FromGitter>
<girng> really just need to get the width or height of a jpg or png
DTZUZO has quit [Ping timeout: 250 seconds]
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
<mps>
j8r: you wanted that: community/libzip: build static libzip.a and add it to -dev apk
<FromGitter>
<j8r> yes mps :)
<mps>
it is pushed right now
<FromGitter>
<j8r> Awesome, thanks a lot mps. Yesterday I've succeeded to run Nextcloud with my statically-linked php :)
<mps>
11:25 ........ algitbot| aports:master |xxxxx x. xxxxxx| community/libzip: build static libzip.a and add it to -dev apk | http://dup.pw/aports/4d1093eb
<mps>
j8r: you are welcome, we all trying to help each other. you help me explaining some things/intricacies about crystal
<FromGitter>
<j8r> exactly mps, 👍
ua has quit [Ping timeout: 246 seconds]
ua has joined #crystal-lang
<FromGitter>
<vivus-ignis> hi! ⏎ is there a way to define a type which covers a class and all of its subclasses? ⏎ that is, to fix a compilation error like this one: ⏎ ⏎ `instance variable '@installed' of PackageManager must be Array(Package), not Array(Package::Deb)` ... [https://gitter.im/crystal-lang/crystal?at=5c59789cc2dba5382ee42b6a]
<FromGitter>
<j8r> have you an example @vivus-ignis ?
<FromGitter>
<j8r> if you do `Array(Package | Package::Deb)`?
<FromGitter>
<j8r> or you can have `alias Packages = Package::Deb | Package::RPM` for example