diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-02-12 18:29:27 -0800 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-02-12 18:29:27 -0800 |
| commit | ae0e6d987781d2fbf225611e2f8df37380a2bbcd (patch) | |
| tree | 0c19a2a320588c7852bc8cdbff5da40624475b71 /downImg.cgi | |
first
Diffstat (limited to 'downImg.cgi')
| -rw-r--r-- | downImg.cgi | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/downImg.cgi b/downImg.cgi new file mode 100644 index 0000000..8eb37a1 --- /dev/null +++ b/downImg.cgi @@ -0,0 +1,56 @@ +my $outputDir="d:/Programe/Apache Server/htdocs/landscape/img";
+##---------------------------------------------------------------------------------------
+##GET THE URLS FROM THE HTTP POST REQUEST
+##---------------------------------------------------------------------------------------
+my $query = new CGI;
+##Get texture url
+my $texture = $query->param("texture");
+if ( !$texture )
+ {
+ ##Problem retrieving the data
+ print $query->header ( );
+ print "no";
+ exit;
+ }
+##Get heigthmap url
+my $heightmap = $query->param("heightmap");
+if ( !$heightmap )
+ {
+ ##Problem retrieving the data
+ print $query->header ( );
+ print "no";
+ exit;
+ }
+
+##---------------------------------------------------------------------------------------
+##DOWNLOAD THE PICTURES TO THE OUTPUT DIR
+##---------------------------------------------------------------------------------------
+##Get texture
+getstore($texture, "$outputDir/Texture_orig.jpg");
+
+##Resize texture to 256x256
+my $image = Image::Resize->new("$outputDir/Texture_orig.jpg");
+my $gd = $image->resize(256, 256);
+open(IMG,">$outputDir/Texture.jpg");
+binmode IMG;
+print IMG $gd->jpeg;
+close IMG;
+
+##Get heightmap
+getstore($heightmap, "$outputDir/Heightmap_orig.jpg");
+
+##Resize heightmap to 256x256
+my $image = Image::Resize->new("$outputDir/Heightmap_orig.jpg");
+my $gd = $image->resize(256, 256, 0);
+open(IMG,">$outputDir/Heightmap.jpg");
+binmode IMG;
+print IMG $gd->jpeg;
+close IMG;
+
+
+##---------------------------------------------------------------------------------------
+##PRINT SUCCESS IN HTML FORMAT
+##---------------------------------------------------------------------------------------
+print $query->header ( );
+print "yes";
+exit;
|
