homepage Welcome to WebmasterWorld Guest from 54.211.34.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Which uses more server resources?
using php to render an image or just serving it up
The_Hat

10+ Year Member



 
Msg#: 4308010 posted 8:16 pm on May 4, 2011 (gmt 0)

I have a site that has to generate many images of varying sizes from original high res images.. Right now I have a pretty wide open permissions folder inside of public_html where the 99/99 user generates those resized images and then I just serve the image using a regular old <img src="whatever.jpg" />.. I know having such a folder inside of root could be a security issue so what I am considering doing is placing the folder they are generated into outside of root and then use php to read that image and render it in the browsers window.. but I'm concerned.

How much more resource intensive on the server is it using php similar to

<?php
$path = str_replace('..','',$_SERVER['QUERY_STRING']);
$fullpath = '/home/folder/folder/'.$path;
if(!is_file($fullpath)) { exit('Image not found');}
header('Content-type:image/jpg');
readfile($fullpath);
?>


than just serving up the .jpg?

 

eelixduppy

WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4308010 posted 9:27 pm on May 4, 2011 (gmt 0)

I doubt you will notice a difference, but technically the PHP solution uses more.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved