E
E
Evgeny Nizamiev2014-06-28 18:23:14
HTML
Evgeny Nizamiev, 2014-06-28 18:23:14

How to get the base64 dimensions of an image?

There is a code, the variable in it "contains" the base64 code of the image. How to get image width and height?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
W
weredy, 2016-02-26
@weredy

If you want it to be a solid block, then, as far as I know, no way. You can use a picture together with holes, then inline elements will wrap around it.

O
Oleg, 2016-02-26
@werty1001

like this

.square,
.square:before,
.square:after {
  border: solid #000 3px;
}
.square {
  position: relative;
  width: 100px;
  height: 100px;
  border-left: 0;
  margin: 0 auto;
}
.square:before,
.square:after {
  content: '';
  display: block;
  position: absolute;
  border-right: 0;
}
.square:before {
  top: 0;
  right: 100%;
  width: 150%;
  height: 40px;
  margin: -3px -3px 0 0;
}
.square:after {
  left: 0;
  top: 40px;
  bottom: 0;
}

jsfiddle.net

T
theWaR_13, 2016-02-26
@theWaR_13

For example, like this: codepen.io/anon/pen/wGvwwN

G
Gregory, 2016-02-26
@TMGLUK

No way. The block can only be rectangular. There is not one block, but two.

A
alc0, 2016-02-27
@alc0

A solid block will not work in any way ... you can only cut down similar garbage, as in the picture ... but why is it and for what, such a block, its function - that's another question what is needed !!!!

R
Roman Zhak, 2014-06-28
@RadiationX

var image = document.createElement('img');

image.addEventListener( 'load', function() {
    // get image.width & image.height
});

image.src = 'data:image/png;base64,…';

eg: jsfiddle.net/minitech/KDdyJ

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question