size

Resizes an image. Shows different error messages if needed. Run without args to see the example of a command usage.

Privateunrated

Content

63 lines
{=(TagName):size}
{=(prefix):!}

{=(COMMENT):Convert's the user's highest color from hex to decimal to apply in the jsons}

{=(value):{replace(, ):{replace(#,):{lower:{user(color)}}}}}
{=(value):{replace(a,10):{replace(b,11):{replace(c,12):{replace(d,13):{replace(e,14):{replace(f,15):{value}}}}}}}}

{=(add1):{value(7)}}
{=(add2):{m:{value(6)}*16}}
{=(add3):{m:{value(5)}*(16^2)}}
{=(add4):{m:{value(4)}*(16^3)}}
{=(add5):{m:{value(3)}*(16^4)}}
{=(add6):{m:{value(2)}*(16^5)}}

{=(decimal):{join():{m:trunc({add1}+{add2}+{add3}+{add4}+{add5}+{add6})}}}

{=(jargs):{join(~):{args}}}

{=(img):{list(0):{jargs}}}
{=(file):{replace(jpg,png):{replace(jpeg,png):{img(0):.}}}}
{=(width):{if(=={list(1):{jargs}}):300|{replace(def,300):{replace(default,300):{list(1):{jargs}}}}}}
{=(height):{if(=={1}):200|{if(=={list(2):{jargs}}):{m:round({width}*(2/3))}|{replace(def,200):{replace(default,200):{list(2):{jargs}}}}}}}
{=(borders):{if(=={list(3):{jargs}}):0|{replace(circle,1000):{replace(max,1000):{list(3):{jargs}}}}}}
{=(bclr):{if(=={list(4):{jargs}}):000001|{replace(black,000001):{replace(white,ffffff):{replace(#,):{lower:{list(4):{jargs}}}}}}}}
{=(bsize):{if(=={list(5):{jargs}}):0|{list(5):{jargs}}}}
{=(bo):{if(!={list(4):{jargs}}):,bo_{bsize}px_solid_rgb:{bclr}}}
{=(newImg):https://res.cloudinary.com/demo/image/fetch/f_{file},w_{width},h_{height},c_fill,r_{borders}{bo}/{img}}

{=(length):{index(%&):{replace(, ):{bclr}} %&}}
{=(hex2num):{replace(a,10):{replace(b,11):{replace(c,12):{replace(d,13):{replace(e,14):{replace(f,15):{bclr}}}}}}}}

{=(hasArgs):{if(!={1}):true|false}}
{=(isValidUrl):{and({in(http):{img}}==true|{in({img(0):.}):png jpg jpeg gif}==true):true|false}}
{=(isValidW):{if({m:sgn({width})}==1):true|false}}
{=(isValidH):{if({m:sgn({height})}==1):true|false}}
{=(isValidBorder):{any({m:sgn({borders})}==1|{borders}==0):true|false}}
{=(isValidHex):{if({m:sgn({hex2num})}==1):true|false}}
{=(isValidLen):{if({length}==6):true|false}}
{=(isValidBSize):{any({m:sgn({bsize})}==1|{bsize}==0):true|false}}

{=(json.noArgs):{"title":"You need to follow the command with a valid image url","description":"```css\n{prefix}{TagName} <direct_image_link> [width] [height] [border_smoothness] [border_color] [border_width]\n\n{prefix}{TagName} https://i.imgur.com/34fNRKA.png 300 300 10 black 2```\n**Default values**\nwidth: `300px`        border smoothness: `0px`\nheight: `200px`       border width: `0px`\n","color":8947967,"footer":{"icon_url":"{user(avatar)}","text":"{replace(-, ):{strf:%F}}"}}}

{=(json.Url):{"description":"Your input is not a [`direct image link`](https://discord.com/channels/186980582863929345/456625369974308866/882368550982017085), try again.","color":13632027}}

{=(json.W):{"title":"The value inputted for the `width` parameter is not a positive integer, try again.","color":13632027}}

{=(json.H):{"title":"The value inputted for the `height` parameter is not a positive integer, try again.","color":13632027}}

{=(json.B):{"title":"The value inputted for the `border smoothness` parameter is not a positive integer, try again.","color":13632027}}

{=(json.Hex):{"title":"Hexidecimal Color Codes should only contain digits 0-9 and letters A-F, there is an invalid character present, try again.","color":13632027}}

{=(json.len):{"title":"There are 6 characters in a Hexidecimal Color Code (no alpha values), try again.","color":13632027}}

{=(json.S):{"title":"The value inputted for the `border size` parameter is not a positive integer, try again.","color":13632027}}

{=(json.success):{"url":"{newImg}","fields":[{"name":"**Borders**","value":"•Border radius: `{borders}px`\n•Border color: `#{bclr}`\n•Border width: `{bsize}px`","inline":true},{"name":"**Size**","value":"•Width: `{width}px`\n•Height: `{height}px`","inline":true}],"title":"Modified image","image":{"url":"{newImg}"},"color":{decimal},"footer":{"icon_url":"{user(icon)}","text":"{replace(-, ):{strf:%F}}"}}}

{=(jsons):json.noArgs json.Url json.W json.H json.B json.Hex json.len json.S json.success}
{=(json):{jsons({index(false):! {hasArgs} {isValidUrl} {isValidW} {isValidH} {isValidBorder} {isValidHex} {isValidLen} {isValidBSize} false})}}

{c:cembed {channel(id)} {{json}}}
Raw JSON
{
  "id": 1037575,
  "created_at": "2021-08-31T20:33:56.000Z",
  "tag_name": "size",
  "nsfw": false,
  "owner_id": "646441336152784954",
  "uses": 241,
  "description": "Resizes an image. Shows different error messages if needed. Run without args to see the example of a command usage.",
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "776901576086388797",
  "sharer": "646441336152784954",
  "content": "{=(TagName):size}\n{=(prefix):!}\n\n{=(COMMENT):Convert's the user's highest color from hex to decimal to apply in the jsons}\n\n{=(value):{replace(, ):{replace(#,):{lower:{user(color)}}}}}\n{=(value):{replace(a,10):{replace(b,11):{replace(c,12):{replace(d,13):{replace(e,14):{replace(f,15):{value}}}}}}}}\n\n{=(add1):{value(7)}}\n{=(add2):{m:{value(6)}*16}}\n{=(add3):{m:{value(5)}*(16^2)}}\n{=(add4):{m:{value(4)}*(16^3)}}\n{=(add5):{m:{value(3)}*(16^4)}}\n{=(add6):{m:{value(2)}*(16^5)}}\n\n{=(decimal):{join():{m:trunc({add1}+{add2}+{add3}+{add4}+{add5}+{add6})}}}\n\n{=(jargs):{join(~):{args}}}\n\n{=(img):{list(0):{jargs}}}\n{=(file):{replace(jpg,png):{replace(jpeg,png):{img(0):.}}}}\n{=(width):{if(=={list(1):{jargs}}):300|{replace(def,300):{replace(default,300):{list(1):{jargs}}}}}}\n{=(height):{if(=={1}):200|{if(=={list(2):{jargs}}):{m:round({width}*(2/3))}|{replace(def,200):{replace(default,200):{list(2):{jargs}}}}}}}\n{=(borders):{if(=={list(3):{jargs}}):0|{replace(circle,1000):{replace(max,1000):{list(3):{jargs}}}}}}\n{=(bclr):{if(=={list(4):{jargs}}):000001|{replace(black,000001):{replace(white,ffffff):{replace(#,):{lower:{list(4):{jargs}}}}}}}}\n{=(bsize):{if(=={list(5):{jargs}}):0|{list(5):{jargs}}}}\n{=(bo):{if(!={list(4):{jargs}}):,bo_{bsize}px_solid_rgb:{bclr}}}\n{=(newImg):https://res.cloudinary.com/demo/image/fetch/f_{file},w_{width},h_{height},c_fill,r_{borders}{bo}/{img}}\n\n{=(length):{index(%&):{replace(, ):{bclr}} %&}}\n{=(hex2num):{replace(a,10):{replace(b,11):{replace(c,12):{replace(d,13):{replace(e,14):{replace(f,15):{bclr}}}}}}}}\n\n{=(hasArgs):{if(!={1}):true|false}}\n{=(isValidUrl):{and({in(http):{img}}==true|{in({img(0):.}):png jpg jpeg gif}==true):true|false}}\n{=(isValidW):{if({m:sgn({width})}==1):true|false}}\n{=(isValidH):{if({m:sgn({height})}==1):true|false}}\n{=(isValidBorder):{any({m:sgn({borders})}==1|{borders}==0):true|false}}\n{=(isValidHex):{if({m:sgn({hex2num})}==1):true|false}}\n{=(isValidLen):{if({length}==6):true|false}}\n{=(isValidBSize):{any({m:sgn({bsize})}==1|{bsize}==0):true|false}}\n\n{=(json.noArgs):{\"title\":\"You need to follow the command with a valid image url\",\"description\":\"```css\\n{prefix}{TagName} <direct_image_link> [width] [height] [border_smoothness] [border_color] [border_width]\\n\\n{prefix}{TagName} https://i.imgur.com/34fNRKA.png 300 300 10 black 2```\\n**Default values**\\nwidth: `300px`        border smoothness: `0px`\\nheight: `200px`       border width: `0px`\\n\",\"color\":8947967,\"footer\":{\"icon_url\":\"{user(avatar)}\",\"text\":\"{replace(-, ):{strf:%F}}\"}}}\n\n{=(json.Url):{\"description\":\"Your input is not a [`direct image link`](https://discord.com/channels/186980582863929345/456625369974308866/882368550982017085), try again.\",\"color\":13632027}}\n\n{=(json.W):{\"title\":\"The value inputted for the `width` parameter is not a positive integer, try again.\",\"color\":13632027}}\n\n{=(json.H):{\"title\":\"The value inputted for the `height` parameter is not a positive integer, try again.\",\"color\":13632027}}\n\n{=(json.B):{\"title\":\"The value inputted for the `border smoothness` parameter is not a positive integer, try again.\",\"color\":13632027}}\n\n{=(json.Hex):{\"title\":\"Hexidecimal Color Codes should only contain digits 0-9 and letters A-F, there is an invalid character present, try again.\",\"color\":13632027}}\n\n{=(json.len):{\"title\":\"There are 6 characters in a Hexidecimal Color Code (no alpha values), try again.\",\"color\":13632027}}\n\n{=(json.S):{\"title\":\"The value inputted for the `border size` parameter is not a positive integer, try again.\",\"color\":13632027}}\n\n{=(json.success):{\"url\":\"{newImg}\",\"fields\":[{\"name\":\"**Borders**\",\"value\":\"•Border radius: `{borders}px`\\n•Border color: `#{bclr}`\\n•Border width: `{bsize}px`\",\"inline\":true},{\"name\":\"**Size**\",\"value\":\"•Width: `{width}px`\\n•Height: `{height}px`\",\"inline\":true}],\"title\":\"Modified image\",\"image\":{\"url\":\"{newImg}\"},\"color\":{decimal},\"footer\":{\"icon_url\":\"{user(icon)}\",\"text\":\"{replace(-, ):{strf:%F}}\"}}}\n\n{=(jsons):json.noArgs json.Url json.W json.H json.B json.Hex json.len json.S json.success}\n{=(json):{jsons({index(false):! {hasArgs} {isValidUrl} {isValidW} {isValidH} {isValidBorder} {isValidHex} {isValidLen} {isValidBSize} false})}}\n\n{c:cembed {channel(id)} {{json}}}",
  "embed": "{}",
  "last_fetched": "2026-10-20T17:30:32.844Z"
}