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 7621085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:06:28+00:00 2026-05-31T04:06:28+00:00

Is there anyway to set a global image setting, route, or anything so that

  • 0

Is there anyway to set a global image setting, route, or anything so that all images reference a CDN url without having to update every image? So when I use the HTML helper like this:

$this->Html->img('some_image.jpg');

Instead of referencing /img/some_image.jpg, it will point to:

http://cdn.example.com/img/some_image.jpg

UPDATE

Final solution was simple. Thanks @burzum for the push in the proper direction. Here is what I did.

In AppController I added:

public $helpers = array(
    'Html' => array(
        'className' => 'MyHtml'
    )
);

Then I created the override helper:

<?php
// app/View/Helper/MyHtmlHelper.php
App::uses('HtmlHelper', 'View/Helper');
class MyHtmlHelper extends HtmlHelper {
    // Add your code to override the core HtmlHelper
    public function image($path, $options = array()) {
        $path = 'http://cdn.localhost/'.$path;
        return parent::image($path, $options);
    }
}
  • 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-05-31T04:06:30+00:00Added an answer on May 31, 2026 at 4:06 am

    Simply overwrite the image() method in a customized helper extending the HtmlHelper and use the 2.1 aliasing feature for helpers:

    public $helpers = array(
        'Html' => array(
            'className' => 'MyHtml'
        )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anyway to stop automatic DataContext inheritance in Silverlight? I Set my DataContext
I was wondering if there's anyway to filter a set using NSPredicate sorted by
there is one think, i can't understand anyway:((( when i try to set cookie(it
Is there any way to set a cookie that is not readable on subdomains?
Is there anyway to set the color of a string resource in android? I
Is there anyway to set the value of a static (private) variable on an
Possible Duplicate: Is there anyway to set values in the settings.bundle from within the
Is there anyway to set the title of a website via JS onload? I
Is there anyway to set the folderBrowserDialog to start in a set folder on
I have a global event created and set/reset in a native C++ process that

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.