Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases > Coding Snippets
You last visited: Today at 07:56

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



SVG Placeholder IMG Generator

Discussion on SVG Placeholder IMG Generator within the Coding Snippets forum part of the Coding Releases category.

Reply
 
Old   #1
 
type.'s Avatar
 
elite*gold: 74
Join Date: Aug 2017
Posts: 284
Received Thanks: 151
SVG Placeholder IMG Generator

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>
type. is offline  
Thanks
1 User
Old 09/16/2017, 15:18   #2



 
False's Avatar
 
elite*gold: 0
The Black Market: 243/0/0
Join Date: Apr 2011
Posts: 11,125
Received Thanks: 2,435
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:

False is offline  
Thanks
1 User
Old 09/16/2017, 17:07   #3
 
type.'s Avatar
 
elite*gold: 74
Join Date: Aug 2017
Posts: 284
Received Thanks: 151
Quote:
Originally Posted by .ƒaℓsє. View Post
Oder simpler und ordentlicher:

und langweiliger. :b
type. is offline  
Old 12/01/2017, 15:58   #4

 
elite*gold: 0
Join Date: Feb 2008
Posts: 2,754
Received Thanks: 1,748
If someone is interested in a way to dynamically generate svg placeholder images, then I guess this is something for further reading:
Computerfreek is offline  
Reply

Tags
generator, php, placeholder, svg


Similar Threads Similar Threads
IMG Hochladen IMG SHARING !!!!
10/06/2012 - Main - 3 Replies
Hallo Leute hab ne Tolle Upload Seite gefunden ! Dort könnt ihr eure Bilder Uploaden ! Die Seite lädt schnell da sie sehr schlicht ist ;) !kaum werbung !!!und mit Backlink zu epvp Hier die Seite: Klick €dit es kann auch Werbung geschaltet werden !!!



All times are GMT +1. The time now is 07:56.


Powered by vBulletin®
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2023 elitepvpers All Rights Reserved.