.htaccess - How to parse a JPG as PHP and return a JPG -


i have dynamic image i'm trying create, worked on 1 web host, until found out removed features, of broke image. moved hostgator, , can't image work on site either. actual php script isn't important, entirely sure works, because when go /image.php displays image, when go /image.jpg not.

what trying here is, have php code inside file jpg extension, have @ /image.jpg, not actual image, php code. need server parse jpg php code, return jpg can use image in places allow images image extensions, such forums. forum on not accept image php extension, that's why need work described.

the thing have found , tried putting in .htaccess:

<files image.jpg> forcetype application/x-httpd-php </files> 

the .htaccess file in same directory image, , method used work, not anymore. i've tested image php hostgator , works fine, need way use /image.jpg again.

in case helps, php script is, takes background image, uses imagettftext alter things such as, view count, ip address display, , few other things. said, script works, tested on hostgator already, need able put script inside jpg file, , have when views jpg, displays image it's supposed to.

any appreciated, thank you.

edit: rewrite trick in .htaccess didn't work either. redirects image.jpg image.php, , forum still won't let me use image. also, apache's config files, i'm pretty sure have access that. i'm not experienced this, in cpanel have access apache handlers, says lets me control how web server handles file types. don't know enter here work need it, think may need. if knows if help, or how use it, please give advice. thank you.

edit: don't know if mean, here image creation parts of script:

header ('content-type: image/jpeg'); header('cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); header('expires: thu, 19 nov 1981 08:52:00 gmt'); header('pragma: no-cache');  $image = imagecreatefromjpeg("background.jpg");  $img_width = 514; $img_height = 128;  imagepng($image); imagedestroy($image); 

you can try like

rewriteengine on rewriterule image.jpg image.php [r=301] 

edited add:

in case didn't know, put in .htaccess file. proper path/to/file of course.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -