Sometimes you just need a placeholder image right at your finger tips. Just enter the width + x + height at the end of this URL and off you go!
Example: nosrc.net/100x100 or nosrc.net/100 creates
<cfscript>
for(param in ["height", "width"]){
if(NOT structKeyExists(url, param) OR NOT isNumeric(url[param])){
url[param] = 100;
}
url[param] = max(min(url[param], 1024), 1);
}
label = "#url.width#x#url.height#";
imageFolder = expandPath("./images/#url.width#");
imagePath = "#imageFolder#/#url.height#.png";
if (!fileExists(imagePath)) {
if (!directoryExists(imageFolder)) {
directoryCreate(imageFolder);
}
newImg = imageNew("", url.width, url.height, "GRAYSCALE", "cccccc");
imageSetDrawingColor(newImg, "333333");
imageDrawText(newImg, "#label#", 4, 16, { size=14, style="bold" });
imageWrite(newImg, imagePath, 0, "true");
}
getPageContext().forward("images/#url.width#/#url.height#.png");
</cfscript>