Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases > Coding Snippets
You last visited: Today at 14:55

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


SVG Placeholder IMG Generator

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2017
Posts: 229
Received Thanks: 126
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

 
elite*gold: 2
The Black Market: 230/0/0
Join Date: Apr 2011
Posts: 9,001
Received Thanks: 2,086
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:



.aℓsє. is offline  
Thanks
1 User
Old 09/16/2017, 17:07   #3
 
elite*gold: 0
Join Date: Aug 2017
Posts: 229
Received Thanks: 126
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



« .net MySQL/ MariaDB Class | Wetter Anzeige »

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



All times are GMT +2. The time now is 14:55.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.