Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="container">
	<h3>Image Size Checker for eBay</h3>
	<p>Author: <a href="https://www.houzhenni.com" target="_blank">Jenny</a></p>
	<h5>eBay requires sellers to use pictures bigger than 500 x 500 px, check if your pics are qualified here</h5>
	<p>How to check:<br>
		Seperate your image URLs with ";"(semicolon) or white space, both are acceptable.<br>
		Put your URLs in the box and press "Get Size".<br>
		Picture smaller than <strong>500 x 500 px</strong> will stand out with red border and red text.
	</p>
	<p>Image URLs to be examined: </p>
	<p>
		<input id="myImg" value="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1495785/profile/profile-80.jpg;https://www.houzhenni.com/myassets/starry-night.jpg;https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2419928724,3244806497&fm=27&gp=0.jpg" type="text"/>
	</p>
	<p>
		<button id="getSize">Get Size</button>
	</p>
	<p>Failed image URLs: </p>
	<p>
		<textarea id="failedImg" style="width: 99.5%; height: 80px;">https://s3-us-west-2.amazonaws.com/s.cdpn.io/1495785/profile/profile-80.jpg
https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2419928724,3244806497&fm=27&gp=0.jpg</textarea>
	</p>
	<p>All images: </p>
	<div id="imgOutput">
		<p><img style="border: 2px solid red;" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1495785/profile/profile-80.jpg" /><span style="color: red;">Picture 1: w 80 x h 80 px</span></p>
		<p><img style="border: 2px black solid;" src="https://www.houzhenni.com/myassets/starry-night.jpg" /><span>Picture 2: w 1280 x h 1014 px</span></p>
		<p><img style="border: 2px solid red;" src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2419928724,3244806497&fm=27&gp=0.jpg" /><span style="color: red;">Picture 3: Invalid Picture Path</span></p>
	</div>
	
</div>
<!-- Default Statcounter code for Codepen - image size
checker http://codepen.io/houzhenni/pen/bMjVLe -->
<script type="text/javascript">
	var sc_project = 11722433;
	var sc_invisible = 1;
	var sc_security = "7fc26bb9";
</script>
<script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script>
<noscript>
	<div class="statcounter"><a title="Web Analytics" href="https://statcounter.com/" target="_blank"><img class="statcounter" src="https://c.statcounter.com/11722433/0/7fc26bb9/1/" alt="Web Analytics"></ a>
	</div>
</noscript>
<!-- End of Statcounter Code -->
              
            
!

CSS

              
                html, body{
  width: 100%;
  margin: 0px;
}
body{
	background: #ffeaa7;
}
::-ms-clear{display: none;}
::-ms-reveal{display: none;}
::-o-clear{display: none;}
#container{
	width: 80%;
	margin: 20px auto;
}
#myImg{
	width: 99.5%;
}
#imgOutput{
	width: 100%;
	padding: 20px;
	box-sizing: border-box;
	border: gray solid 1px;
}
#imgOutput img{
	max-height: 80px;
	min-height: 80px;
}
              
            
!

JS

              
                /* statcounter code start */
var sc_project=11722433; 
var sc_invisible=1; 
var sc_security="7fc26bb9"; 

var statStr = '<a title="Web Analytics" href="http://statcounter.com/" target="_blank"><img class="statcounter" src="//c.statcounter.com/11722433/0/7fc26bb9/1/" alt="Web Analytics"></a>';
var statDiv = document.createElement("div");
statDiv.className = "statcounter";
statDiv.innerHTML = statStr;
document.getElementsByTagName("body")[0].appendChild(statDiv);

var statScript = document.createElement("script");
statScript.src = "https://www.statcounter.com/counter/counter.js";
document.getElementsByTagName("body")[0].appendChild(statScript);
/* statcounter code end */


var needCopy = true;
var myImg = document.getElementById("myImg");
myImg.onfocus = function(){
	this.select();
}
var getSize = document.getElementById("getSize");
myImg.onkeydown = function(e){
	if(e.keyCode == "13"){
		getSize.click();
		this.blur();
	}
}
var imgOutput = document.getElementById("imgOutput");
var outputValue = "";
var container = document.getElementById("container");
var failedImg = document.getElementById("failedImg");
failedImg.onclick = function(){
	if (needCopy) {
		this.select();
		document.execCommand("copy");
		setTimeout(function() {
			alert("Failed Image URLs copied successfully")
			needCopy = false;
		}, 100);
	}
}
failedImg.onchange = function() {
	needCopy = true;
}
getSize.onclick = function(){
	var imgSrc = myImg.value;
	imgOutput.innerHTML = "";
	failedImg.value = "";
	console.log("failedImg.value = ")
	console.log(failedImg.value);
	if(imgSrc.indexOf(" ")){
		imgSrc = imgSrc.replace(/\s+/g, ';');
	}
	if(imgSrc.indexOf(";")){
		imgSrc = imgSrc.split(";");
	}
	var tempArr = [];
	for(var k = 0; k < imgSrc.length; k++){
		if(imgSrc[k]){
			tempArr.push(imgSrc[k].replace(/\s+/g, ""));
		}
	}
	imgSrc = tempArr;
	if(imgSrc.length == 0){
		return;
	}
	let i = 0;

	function iterateImg(){
		var img = new Image();
		img.src = imgSrc[i];
		img.style = "border: solid black 2px;";
		var p = document.createElement("p");
		var link = document.createElement("a");
		link.href = imgSrc[i];
		link.target = "_blank";
		link.appendChild(img);
		p.appendChild(link);
		var tempSpan = document.createElement("span");
		img.onload = function(){
			tempSpan.innerHTML = "Picture " + (i + 1) + ": w " + img.width + " x h " + img.height + " px";
			if(img.width < 500 || img.height < 500){
				img.style.borderColor = "red";
				tempSpan.style = "color: red;"
				failedImg.value += imgSrc[i] + "\n";
			}
			p.appendChild(tempSpan);
			imgOutput.appendChild(p);
			if(i < imgSrc.length - 1){
				i++;
				iterateImg();
			}else{
				return;
			}
		}
		img.onerror = function(){
			tempSpan.innerHTML = "Picture " + (i + 1) + ": Invalid Picture Path";
			img.style.borderColor = "red";
			tempSpan.style = "color: red;"
			failedImg.value += imgSrc[i] + "\n";
			p.appendChild(tempSpan);
			imgOutput.appendChild(p);
			if(i < imgSrc.length - 1){
				i++;
				iterateImg();
			}else{
				return;
			}
		}	
	}
	iterateImg();
}
              
            
!
999px

Console