szcieder Posted April 26, 2008 Share Posted April 26, 2008 Hi everyone, I'm a new member here, and I need a little help with my PHP coding, I saw your coding just now and I registered lately. I was hoping maybe someone could help me with something. I'm trying to find a code for my site (www.poke-mania.net). and I have alot of images. So how can I make a my Picture Generator out of PHP? I want something like... www.poke-mania.net/showpic.php?name=IMAGE so when we try to view something like that it results to www.poke-mania.net/image.png so when I want to have another name for it... www.poke-mania.net/showpic.php?name=IMAGE2 it also results to... www.poke-mania.net/image.png and will apply to many images I want to put on the php file? how can I do that? Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/ Share on other sites More sharing options...
szcieder Posted April 26, 2008 Author Share Posted April 26, 2008 Here's the PHP code to view multiple images. But it only loads one image, just the 001 but I want different and multiple images to be displayed when the code is writed. pic.php?sprite=001 can anyone edit the code so that not just the 001 can be loaded? But all images on the directory? <?php // Load the sprite into memory $imgTorso=imageCreateFromPng("http://www.poke-mania.net/sprites/dp/001.png"); $imgBlend=imageCreateFromPng("http://www.poke-mania.net/sprites/dp/001.png"); // Load his clone too // Load the height and width of the image $sx=imagesx($imgBlend); $sy=imagesy($imgBlend); // Output for Browser imagecopymerge($imgTorso,$imgBlend,0,0,0,0,$sx,$sy,50); imagefill($imgTorso,0,0,$background); imagecolortransparent($imgTorso,$background); header("Content-type: image/png"); imagePng($imgTorso); ?> Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/#findComment-527715 Share on other sites More sharing options...
imdead Posted April 26, 2008 Share Posted April 26, 2008 goto http://www.poke-mania.net/pic.php?id=1 << loads image 1 or goto http://www.poke-mania.net/pic.php?id=2 << loads image 2 NOTE: not tested <?php $id = $_POST['id']; // Load the sprite into memory $imgTorso=imageCreateFromPng("http://www.poke-mania.net/sprites/dp/$id.png"); $imgBlend=imageCreateFromPng("http://www.poke-mania.net/sprites/dp/$id.png"); // Load his clone too // Load the height and width of the image $sx=imagesx($imgBlend); $sy=imagesy($imgBlend); // Output for Browser imagecopymerge($imgTorso,$imgBlend,0,0,0,0,$sx,$sy,50); imagefill($imgTorso,0,0,$background); imagecolortransparent($imgTorso,$background); header("Content-type: image/png"); imagePng($imgTorso); ?> Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/#findComment-527719 Share on other sites More sharing options...
szcieder Posted April 26, 2008 Author Share Posted April 26, 2008 Nope, it displays the default image, please test it and put a secondary image so that you will have choices on the URL to load the images. $id = $_POST['id']; is correct though. Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/#findComment-527721 Share on other sites More sharing options...
szcieder Posted April 26, 2008 Author Share Posted April 26, 2008 .... let me remind you that it should be loaded like this. pic.php?id=1 then redirects to image.png same as also for another image pic.php?id=NAMEOFIMAGEIWANT also redirects to image.png Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/#findComment-527731 Share on other sites More sharing options...
szcieder Posted April 27, 2008 Author Share Posted April 27, 2008 What if I want to access the image using a fake URL like... www.example.net/showpic.php?name=IMAGE and the real URL of the file is... www.example.net/myphoto123.png how can I do that? Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/#findComment-528175 Share on other sites More sharing options...
schme16 Posted April 27, 2008 Share Posted April 27, 2008 thats easy, if you want something like that just do this: <?php $image = file_get_contents('location/of/file/'.$_GET['name'].'.jpeg'); header("Content-Type: image/jpg"); exit("$image") ?> although, if your going to go that far, I'd use a database. Quote Link to comment https://forums.phpfreaks.com/topic/103016-image-cloaking-php-code-help/#findComment-528194 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.