SVG Placeholder IMG Generator

09/15/2017 16:13 type.#1
Aye folks! This is pretty simple and i guess most of you will understand what this does therefore i'm not saying too much. (:

Code:
<?php

	$width = isset($_GET['w']) ? $_GET['w']: '300';
	$height = isset($_GET['h']) ? $_GET['h']: '200';
	$stroke = isset($_GET['s']) ? $_GET['s']: '222';
	$fill = isset($_GET['f']) ? $_GET['f']: 'fafafa';

	if (preg_match('([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})', $stroke)) { $stroke = '#'.$stroke; }
	if (preg_match('([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})', $fill)) { $fill = '#'.$fill; }

	header('Content-Type: image/svg+xml');

?>

<svg xmlns="http://www.w3.org/2000/svg" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
	<g>

		<rect width="<?php echo $width ?>" height="<?php echo $height; ?>" y="0" x="0" stroke="<?php echo $stroke; ?>" fill="<?php echo $fill; ?>"/>
		<line x1="0" x2="100%" y1="0" y2="100%" stroke="<?php echo $stroke; ?>"/>
		<line x1="100%" x2="0" y1="0" y2="100%" stroke="<?php echo $stroke; ?>"/>

	</g>
</svg>
09/16/2017 15:18 False#2
Quote:
Originally Posted by type. View Post
Aye folks! This is pretty simple and i guess most of you will understand what this does therefore i'm not saying too much. (:

Code:
<?php

	$width = isset($_GET['w']) ? $_GET['w']: '300';
	$height = isset($_GET['h']) ? $_GET['h']: '200';
	$stroke = isset($_GET['s']) ? $_GET['s']: '222';
	$fill = isset($_GET['f']) ? $_GET['f']: 'fafafa';

	if (preg_match('([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})', $stroke)) { $stroke = '#'.$stroke; }
	if (preg_match('([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})', $fill)) { $fill = '#'.$fill; }

	header('Content-Type: image/svg+xml');

?>

<svg xmlns="http://www.w3.org/2000/svg" width="<?php echo $width; ?>" height="<?php echo $height; ?>">
	<g>

		<rect width="<?php echo $width ?>" height="<?php echo $height; ?>" y="0" x="0" stroke="<?php echo $stroke; ?>" fill="<?php echo $fill; ?>"/>
		<line x1="0" x2="100%" y1="0" y2="100%" stroke="<?php echo $stroke; ?>"/>
		<line x1="100%" x2="0" y1="0" y2="100%" stroke="<?php echo $stroke; ?>"/>

	</g>
</svg>
Oder simpler und ordentlicher:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
09/16/2017 17:07 type.#3
Quote:
Originally Posted by .ƒaℓsє. View Post
Oder simpler und ordentlicher:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
und langweiliger. :b
12/01/2017 15:58 Computerfreek#4
If someone is interested in a way to dynamically generate svg placeholder images, then I guess this is something for further reading: [Only registered and activated users can see links. Click Here To Register...]