[catoverflow] svg logo through php or pure html or simply png ?

catoverflow.jpg


well, i think im up for an early night, i was almost going to post another music snip or ancient render to keep the pace up until i can turn the pace down but despite everything i got clear enough to fix something in the dark.
what's the main problem these days ? especially when moving to blockchain, like EVERYTHING seems to be moving to blockchain ... processing speed ?

or volume ?

as i just discovered the existence of an svg - tag (which might be around for years for all i know, i havent been keeping much track of anything, seems like steemit succeeds in at least keeping a little bit of fire lit there

and tried to make a logo like here in this post

looking like

i got to the point where the html code was smaller than the bitmap (or png or jpg) by about 3kb ...

what's 3kb ? i mean it's all about the gigs right ? how much ddr5 you got ? 64 ? 128 ?

what's 3kb for a webserver at thousands or maybe millions of requests per minute ?

i think thats more the way to ask it so, since i like making logos (not for your deskjob there, mate, 15 years too late for that, i don't fit in a pipeline, i'm too damaged and not oil) i figured, handcrafted html is nice but php is nicer

now since i'm not in the habit of using anything daily but computers itself, ofcourse i had to pray to the 1e100 for guidance


https://www.w3schools.com/php/php_functions.asp https://www.ostraining.com/blog/coding/arrays/

https://stackoverflow.com/questions/3406726/echo-key-and-value-of-an-array-without-and-with-loop

https://www.w3schools.com/php/php_looping_for.asp

https://stackoverflow.com/questions/4383914/how-to-get-single-value-from-php-array

http://php.net/manual/en/function.explode.php


lots of guidance ... i feel php a bit rigid, maybe b/c my first babysteps on generated pages was perl but the hosting service i used (when i had a life and stuff, girlfriend and all that, living together in a not my parents house ... lOng ago when the world was young and yahoo was still a brandname *chucklez-)

nasty little mistakes like trying to do a calculation in an array itself like echo $matrix[($x*$ŷ+2)/4]; doesn't seem to work out very well, for some reason its like i have to do the calculation, stick it in a variable and THEN use that var in the array ... which is ... well ....
never mind its a scripting language after all but then again so is perl ... and i end up with something that might be adjustable, re-usable and the base of something that could generate different logos in different styles (within the same parameters ofcourse, one function per) which is what php is built for ofcourse : generate
m yea, i know objects and classes and other fancy new words but i'm still stuck on words like syntax and re-usable , which doesnt really matter to me since i dont do it for someone elses wallet at a 9 to 5 desk (that would kill me even more dead than i already am and kill all the fun of it at the same time)

<?php
$charset=array(
"A" => "1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,0,0,1",
"C" => "1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1",
"E" => "1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1",
"Y" => "1,0,0,1,1,0,0,1,1,1,1,1,0,1,1,0,0,1,1,0"
);
$grid_x=20;
$grid_y=20;
$charwidth=4;
$letters = array("A", "C", "E", "Y"); 
function drawletter($matrix,$sizex,$sizey,$offset,$charwidth){
for ($y = 0; $y <= 4; $y++) {

    for ($x = 0; $x <=3; $x++){
        $temp = $y*4+$x;
        #$offset*=$charwidth;
        $curx=$sizex*$x+$offset;
        $cury=$sizey*$y;
        if ($matrix[$temp] == "1" ){
            $printstring = '<rect x='.$curx.' y='.$cury.' rx=5 ry=5 width='.$sizex.' height='.$sizey.' style="fill:gainsboro;stroke:black;stroke-width:5;opacity:0.7" />';
            echo $printstring ; 

        }
    }
}
}
echo '<svg width="400" height="100">';
echo '<rect width="400" height="100" style="fill:rgb(0,0,0);stroke-width:10;stroke:rgb(100,100,100)" />';
echo '<circle cx="0" cy="0" r="200" stroke="white" stroke-width="1" fill="dimgrey" />';
$letter= explode(",", $charset["A"]);
drawletter($letter,$grid_x,$grid_y,0);
$letter= explode(",", $charset["C"]);
drawletter($letter,$grid_x,$grid_y,82);
$letter= explode(",", $charset["E"]);
drawletter($letter,$grid_x,$grid_y,163);
$letter= explode(",", $charset["Y"]);
drawletter($letter,$grid_x,$grid_y,244);
echo '</svg>';
?>


all very cute with the keys and values and exploding strings and all that but for some reason it feels elaborate ... like lourd ... heavy , lol

im sure some who does it on the delli can make it much more compact but see that's the thing : that doesn't matter with php

that matters with html, your php wether you write every instruction or use loops wont use much more or less cycles in processing, but the generated code (which is the same as the manually crafted code from before actually once its in your browzerz) will use more network , euh, bandwidth ?

the network load is exactly the same wether you push handcrafted html or php generated since you get the exact amount of kb (if you remove the whitespaces and newline characters)

SO, what's best ? pure html ? php ? or an image ?
in fact handcrafted pure html would use the least overall resources since it doesnt have to be processed serverside and it has the exact same size pushing through the cables to the client as the php generated code

however


when i heard about webassembly i was all like YAY, here come the 256byte OMG-WOWpages ... but turns out despite the impressive demo that its basically a layer or compiler for C in browsers ... so i havent heard much about it either which leaves

the old trusty javascript

javascript can print to document as far as i know so if the whole logo can be fitted into a oneliner formula that's your winner , no serverside processing, superminimal filesize and network load, unless mozillafox comes up with actual assembler lol i think that would be IT

I T .. ahha hah hah

yea so i can give myself some ergotherapeutic homework there and see how much kb it saves when done purely in js

sometime ... when its night
and quiet and the stars are in the right position

and HOI, i has a content (i wish i could have $200 posts so i only need one a week lol, boy could i take time then ehj?

right-O, its nighto but im exhausted, didnt get like 5 minutes of sleep again, so i'll have to cave in and face the morninglight ... dive back in bed by noon and sleep off the horrid daytime. Maybe it's use to someone, or maybe not, which would make it like about 99.99% of all steemit posts i guess hahah

1.png

every post that doesnt reach my minimum ubi requirement after 24 hours will be upvoted with bots to the max extent of my resources. This benefits me and this benefits people i vote on, this benefits people who vote on my little distro-for-plankton project and whatever the moralizing by fat fish, i dont really care, if i sit around waiting for handouts and cookies i'll be old and grey before i'm anywhere

Sort:  

maybe you might use this and you need this, why? the secret is all html class objects can be accessed via css style tags, what you want is a pr-written bootstrap file and then maybe a script with the action functions or actions you would like to give to an object like moving, resizing or fading what ever. i know google has some free really cool bootstrap files

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.032
BTC 62280.19
ETH 2997.56
USDT 1.00
SBD 4.08