I'm creating a dating site where users could upload their images, some private and some public.
What I planned to do is to save all the uploaded images, and when I would like to show them I will have a script that will call them.
ie: url-> mysite.com/members/mainimage/5
the function that handles this call is: public function mainImage($user) {
$this->load->model('tables/user_images_table');
$image = $this->user_images_table->getMainUserImage($user);
if($image != null ) {
$imageExploded = explode('.',$image);
switch( $imageExploded[1] ) {
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default:
}
$imagePath = 'uploads/'.$image;
} else {
//default image
$imagePath = 'inner/default.png';
$ctype = 'image/png';
}
header('Content-type: '.$ctype);
readfile(base_url()."images/".$imagePath);
}
but after I see my site is getting bigger, I notice that each user image request all my appliaction files are loaded, and it probably will slow my site down.
do you have any idea how to save private images (that wont will be public by url, only after some checks on the user)