Go Back   Gaming Gutter > Non-Gaming > Programming > Source Code


Source Code - Have a source code/project files you want to post? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post mOBSCENE's score sender...
Today 01:11 AM
Last post by 1x1
Today 04:33 AM
6 Replies, 30 Views
Go to first new post I *think* I just got...
Today 02:03 AM
Last post by Hodizzle
Today 03:07 AM
6 Replies, 33 Views
Go to first new post Lil Wayne
10-21-2008 09:33 PM
Last post by Toffie
Today 02:49 AM
46 Replies, 391 Views
Go to first new post forgot my birthday i put...
10-30-2008 09:27 AM
by dookie
Last post by seleporx
Today 02:29 AM
23 Replies, 490 Views
Go to first new post Plastic Surgery Hell
Yesterday 08:02 PM
by Li-Shun
Last post by Hodizzle
Today 01:51 AM
11 Replies, 62 Views
Reply
 
LinkBack Thread Tools Display Modes

 Symmetric image generator
Old 12-16-2006, 06:00 AM   #1 (permalink)
Underground

Male gommle is offline
 
gommle's Avatar
 
Join Date: Sep 2006
Location: The o great land of Nooooooreeeway
Age: 20
Posts: 658
GPoints: 38
iTrader: 0 / 0%
gommle Is Recognizable
Rep Power: 7
Symmetric image generator

Can be used for many funny results

PHP Code:
<?php
# Mirror image
// mirrorimage.php?flip=1&url=http%3A%2F%2Fwww.google.com%2Fpress%2Fimages%2Fsergey_brin_lg.jpg

$type $_GET['flip']; // 1 or 2
if(!$type) { $type 2; }

$file rand(0,20).'.jpg';

$fh fopen("/tmp/".$file"wb");
        
fwrite($fhcurl_get($_GET['url']));
        
fclose($fh);


$im ImageCreateFromJpeg("/tmp/".$file);
if(!
$im) { die("lol"); }

$mi fliph($im);


if(
$type == 1) {
    
// make half of $mi transparent
    
$transparent ImageColorAllocate($mi255,0,255);
    
imagefilledrectangle($miimagesx($mi)/20imagesx($mi), imagesy($mi), $transparent);
    
imageColorTransparent($miimagecolorexact($mi,255,0,255));

    
// combine them
    
$insert_x imagesx($mi);
    
$insert_y imagesy($mi);

    
imagecopymerge($im,$mi,0,0,0,0,$insert_x,$insert_y,100); 
} else {

    
// make half of $mi transparent
    
$transparent ImageColorAllocate($mi255,0,255);
    
imagefilledrectangle($mi,00imagesx($mi)/2imagesy($mi), $transparent);
    
imageColorTransparent($miimagecolorexact($mi,255,0,255));

    
// combine them
    
$insert_x imagesx($mi);
    
$insert_y imagesy($mi);

    
imagecopymerge($im,$mi0,0,0,0,$insert_x,$insert_y,100); 

}
// Echo image

header('Content-Type: image/png');

ImagePNG($im);

// Free RAM

ImageDestroy($mi);
ImageDestroy($im);

function 
fliph($im) {
    
$x_size imagesx($im);
    
$y_size imagesy($im);
    
$tmp imagecreatetruecolor($x_size$y_size);
    
$x imagecopyresampled($tmp$im00, ($x_size-1), 0$x_size$y_size0-$x_size$y_size);
    if (
$x) {
        
$im $tmp;
        return 
$im;
    }
    else {
        die(
"Error!");
    }
}

?>

<?php
# Function to get a file from an url using cURL
    
function curl_get($url) {
        
$curl curl_init();
        
curl_setopt ($curlCURLOPT_URL$url);
        
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
        
$data curl_exec ($curl);
        
curl_close ($curl);
        return 
$data;
    }
    
    
# Function to write data to disk
    
function savefile($filename$data) {
        
$fh fopen("/tmp/$filename""wb");
        
fwrite($fh$data);
        
fclose($fh);
    }

?>
Here's a file to make it easier to use, just put it in the same dir as mirrorimage.
PHP Code:
<html>
<head>
<title>
bbw
</title>
<body>
JPEG URL <form action="?" method="post"><input type="text" name="url" /> <input type="submit" value="mirror image"></form>
<img src="mirrorimage.php?flip=1&url=<?=urlencode($_POST['url']);?>"/><br />
<img src="mirrorimage.php?flip=2&url=<?=urlencode($_POST['url']);?>"/><br />
</body>
If it doesn't work you might have to turn up the memory limit in php.ini.

Here's a working example:
http://vestberg.net/~gommlem/flip.php

__________________

  Reply With Quote

 Re: Symmetric image generator
Old 12-16-2006, 06:07 AM   #2 (permalink)
Ryan
Guest

 
Posts: n/a
GPoints: 0 [Check]
iTrader: / %
Rep Power:
Re: Symmetric image generator

Wtf does it do?

-gj though i suppose..+rep. +26 rep 4 j00
  Reply With Quote

 Re: Symmetric image generator
Old 12-16-2006, 06:39 AM   #3 (permalink)
Underground

Male gommle is offline
 
gommle's Avatar
 
Join Date: Sep 2006
Location: The o great land of Nooooooreeeway
Age: 20
Posts: 658
GPoints: 38
iTrader: 0 / 0%
gommle Is Recognizable
Rep Power: 7
Re: Symmetric image generator

I didn't get that rep :O

Here's another pic btw:
Attached Images
File Type: jpg orly.jpg (12.3 KB, 2 views)
__________________


Last edited by gommle; 12-16-2006 at 06:53 AM.
  Reply With Quote

 Re: Symmetric image generator
Old 12-16-2006, 11:37 AM   #4 (permalink)
Banned

Male Carnage is offline
 
Join Date: Sep 2006
Location: Saco, Maine
Age: 18
Posts: 1,879
GPoints: 380
iTrader: 1 / 100%
Carnage Is Popular
Rep Power: 0
Re: Symmetric image generator

Wtf? Random program much? Where do you think of this stuff? o_O
  Reply With Quote

 Re: Symmetric image generator
Old 12-16-2006, 12:35 PM   #5 (permalink)
Underground

Male gommle is offline
 
gommle's Avatar
 
Join Date: Sep 2006
Location: The o great land of Nooooooreeeway
Age: 20
Posts: 658
GPoints: 38
iTrader: 0 / 0%
gommle Is Recognizable
Rep Power: 7
Re: Symmetric image generator

It's a 4chan meme. I just made a easier way to make them :P
__________________

  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 04:38 AM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.23493409 seconds (100.00% PHP - 0% MySQL) with 20 queries