ratcateme Posted June 30, 2008 Share Posted June 30, 2008 I have this script <?php header("Content-type: image/jpeg"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); $image = fopen("./images/{$id}.jpg","r"); while(!feof($image)){ echo fgets($image); } fclose($image); ?> it use to look like this <?php header("Content-type: image/jpeg"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); include("./images/{$id}.jpg"); ?> but one image i tried to include contained <? so was phrased as php code i want to know if there is a quicker way to include files without them being phrased as php code even if they contain <?. or is the fopen method just as quick as include i also want a method that is easy on ram as my server is kinda low Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/ Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 str_replace() or substr() might help with this. ACE Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577851 Share on other sites More sharing options...
ratcateme Posted June 30, 2008 Author Share Posted June 30, 2008 that would make the script more complicated than the first one (which works). all i want to know if there is a way to use include and not phrase as php code even if it includes <? Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577884 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 this might be a stupid question, but why would the name of a image contain <? ??? Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577887 Share on other sites More sharing options...
papaface Posted June 30, 2008 Share Posted June 30, 2008 Shouldn't you just be using an image tag ??? <?php header("Content-type: image/jpeg"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); ?> <img src="/images/<?php echo $id; ?>.jpg" /> Makes more sense imo. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577889 Share on other sites More sharing options...
ratcateme Posted June 30, 2008 Author Share Posted June 30, 2008 open a .jpg in a text editor all the characters could be anything in one i tried to include it contained "<" then "?" next to each other very unlikely yes put still possible. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577891 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 but why open a image in a text editor? you've really lost me lol Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577892 Share on other sites More sharing options...
ratcateme Posted June 30, 2008 Author Share Posted June 30, 2008 this file pretends to be an image so i would have an img tag in another file like this <img src="display.php" /> then it uses $_SESSION to include the correct image. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577893 Share on other sites More sharing options...
ratcateme Posted June 30, 2008 Author Share Posted June 30, 2008 but why open a image in a text editor? you've really lost me lol did you try?? when u look at it, it is made up from a bunch of characters that make no sense to use reading them but will work for a program displaying them as a image Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577895 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 obviously. But why not just do it the normal HTML way as papaface has said. because it makes sense, and you appear to be doing the same thing, the hard way. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577896 Share on other sites More sharing options...
ratcateme Posted June 30, 2008 Author Share Posted June 30, 2008 i am making an easy to understand CAPTCHA using images like pictures of a ball, flower, homer Simpson, tree ... then i use $_SESSION to tell display.php which image to display if i used an img tag then a script could easily tell which image is being displayed this way people cant tell which image is being displayed. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577899 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 ok, that makes more sense. However there still is easier ways. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577904 Share on other sites More sharing options...
papaface Posted June 30, 2008 Share Posted June 30, 2008 Well then you need to use a dynamic image, but nevertheless, you're gonna need to use an image tag and not an include. e.g: <img src="image.php?var=somequery" /> Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577910 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 let PHP create the image, embedding whatever other image you want inside it. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577912 Share on other sites More sharing options...
ratcateme Posted June 30, 2008 Author Share Posted June 30, 2008 don't worry guys it seems there are not any easier ways of including a page and not phrasing it for the purpose i want. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577914 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 ok, good luck with the script anyway. Quote Link to comment https://forums.phpfreaks.com/topic/112531-solved-dont-evaluate-include/#findComment-577916 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.