TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-05-2008, 03:42 PM   #21 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
I tried the following which seemed to work ok on my system:

RewriteCond %{QUERY_STRING} ^[a-z0-9]{1,20}\.(?:jpe?g|gif|png|bmp)$ [NC]
RewriteRule ^image$ img.php?img=%0 [L]


One thing to note is that your PHP file shouldn't be named the same as what comes before the query string, ie image?test.jpg should not use image.php because it appears that Apache's content negotiation gets in the way and serves up the PHP page without going through the rewrite process. Simply rename the PHP page to something else as I have in my example above, img.php
i guess its just me cause that didnt work either

Update: I see an error, and now it fixed the problem, haha, slathe always has the answer. :P
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 05-07-2008, 10:26 AM   #22 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

UPDATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Jpeg images don't work xD

RewriteCond %{QUERY_STRING} ^[a-z0-9\.\_\-]{1,20}\.(?:jpeg|gif|png|bmp)$ [NC]
RewriteRule ^image$ img.php?img=%0 [L]
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 05-07-2008, 10:28 AM   #23 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

By the way, heres my php code:
PHP Code:
if (empty($_GET['img'])) exit();

$img pathinfo($_GET['img']);
$ext $img['extension'];
DEFINE('IMAGE_PATH','images/');

switch(
$ext)
{
    case 
'jpg':

        
$im imagecreatefromjpeg(IMAGE_PATH $_GET['img']);


            
header("Content-Type:image/jpeg");
            
imagejpeg($im,null,100);
        

        break;
        

    case 
'gif':

        
$im imagecreatefromgif(IMAGE_PATH $_GET['img']);

    
            
header("Content-Type:image/gif");
            
imagegif($im);
        
        break;
    case 
'png':

        
$im imagecreatefrompng(IMAGE_PATH $_GET['img']);
        
imagesavealpha($im,true);
        
header("Content-Type:image/png");
        
imagepng($im);
        break;

__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 06:03 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design