开发者

403 Error using WideImage with CodeIgniter

开发者 https://www.devze.com 2023-03-20 23:49 出处:网络
My application uses WideImage successfully to crop & resize images. I call this on images using the following:

My application uses WideImage successfully to crop & resize images. I call this on images using the following:

<img src="<?=asset_url()?>scripts/thumb.php?src=<?=$post['picture']?>" />

Where asset_url() is a function that returns the path to my assets folder. The folder structure is:

| assets
| application
| system

This works fine, but my assets folder should just contain images, JS files and CSS.

If I try and move the thumb.php file to any folder within the application directory, I get a 403 error.

Is this a feature of CodeIgniter to stop direct access to files? If so, how do I get around it?

I'm using a default .htaccess file, which looks something like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]  
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ inde开发者_Python百科x.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>  
ErrorDocument 404 /index.php
</IfModule>

Thanks!


I think it's a correct behaviour of any framework. It's just dont' give you the freedom to make your app completely non-understandable by any other developers.

For example if I developer of X-framework and don't expect blah.php in the app folder -- the good framework will help ME (not the author :) ). So in the result we will have a good quality code.

But in your concrete question, I think you should just create some controller/action -- and not directly call blah.php

0

精彩评论

暂无评论...
验证码 换一张
取 消