Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8024869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:58:54+00:00 2026-06-04T22:58:54+00:00

Need Help, I want create an image access caching, example image at url example.com/caching/m_images.jpg

  • 0

Need Help, I want create an image access caching, example image at url

example.com/caching/m_images.jpg

if that image exists then show image, but if don’t exist, maybe with .htaccess script, to run image function at :

example.com/recaching/m_images.jpg

to create new image with custom size at caching folder, then access again the image url.
How to do this, or there is another better solution ??
Thanks.

ps
I already have little script htaccess to remove ‘index.php?’ from codeigniter url

RewriteEngine on
RewriteCond $1 !^(index\.php|js|css|caching)
RewriteRule ^(.*)$ index.php/$1 [L]

so the real url of function is:

example.com/index.php?recaching/m_images.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:58:55+00:00Added an answer on June 4, 2026 at 10:58 pm

    How about:

    RewriteEngine on
    RewriteRule ^images/(.*)$ index.php/recaching/$1 [L,QSA]
    RewriteCond $1 !^(index\.php|js|css|caching)
    RewriteRule ^(.*)$ index.php/$1 [L]
    

    the above “should” (i’ve not tested it) redirect any requested files inside the images folder (assuming you have an images folder) and passes the path to the route recaching.

    You can then, using file_exists, readfile and header write the file to the browser if it does not exist.

    i.e.

    function recaching($path)
    {
        $tmpPath = FCPATH . 'images/' . $path;
        if(!file_exists($tmpPath))
        {
            // change $tmpPath to a file that exists, i.e. a 404 image
            // or if you are generating an image when one doesn't exist
            // create it here.
        }
        $info = getimagesize($tmpPath);
        if($info !== false)
        {
            header('content-type: ' . $info['mime']);
            readfile($tmpPath);
        }
        else
        {
            die('There was a problem rendering the image.');
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a help about creating custom wpf controls.I want to create a template
I want to create user profile with image. That user can upload his photo,
I need to create a html parser, that given a blog url, it returns
I almost have the data I want...but need help filtering it. (pic at bottom)
I need some help at RPC Programming. I really want understand how works the
I need your help with this one again. I want to send special characters
I need some help with CSS overflow in IE, namely IE 7. I want
I am somewhat new to blocks and need some help. I want to store
I tried a lot, now I need your help. What I want to do
Need a little help with my jquery here I want all my button with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.