[RFC|Accepted] Overridable imageset and theme paths for CDNs

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by Oleg »

All occurrences of image references in phpbb can (currently) be found with a fairly small number of regular expressions. I run several global search and replace operations to append timestamps to my asset urls in deployment. These timestamps allow me to cache assets indefinitely via expires headers (while serving them from the same vhost as the scripts).

I suspect it would not be too hard to transform relative paths into absolute urls, based on which file the paths occur in.

Now, this assumes you are not generating stylesheets on the fly via style.php. If you do, if my memory is correct you would need some less trivial changes to phpbb code to timestamp assets.

Rahul
Registered User
Posts: 3
Joined: Mon Aug 30, 2010 3:23 pm

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by Rahul »

I need to ask 1 thing... how can these changes automatically select http or https depending upon the way header request them?

User avatar
Sierron
Registered User
Posts: 62
Joined: Wed Aug 25, 2010 11:41 am
Contact:

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by Sierron »

+1

I would love to have that without needing to rewrite everything.
GravityDK wrote:I would use a subdomain to get the parallel downloads: like subdomain.mysite.com.
That :)

Rahul
Registered User
Posts: 3
Joined: Mon Aug 30, 2010 3:23 pm

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by Rahul »

Code: Select all

imageset:
in session.php
Code: Select all$img_data['src'] = 'http://cdn.varjanta.com/static/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename'];
What about theme images? Images that load from theme folder...what setting we must do?

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by nickvergessen »

Well we removed the imagesets, so this RFC needs to be adjusted a bit ;)
Member of the Development-TeamNo Support via PM

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by Oleg »

http://www.phpbb.com/community/viewtopi ... #p13102378
Oleg wrote:It is fairly straightforward to find all references to static assets in phpbb via regular expressions. The challenge is that image urls and such are relative, not absolute. You would have to process each level of files separately to properly convert relative to absolute urls. Then you could prepend host and path to the urls to make all urls point to the cdn of your choice.

You can use my asset timestamping script for inspiration: https://gist.github.com/1645495 (built and tested against phpbb 3.0.5 or so).

MarcoDM
Registered User
Posts: 2
Joined: Fri Aug 21, 2009 12:07 am

Re: [RFC|Accepted] Overridable imageset and theme paths for

Post by MarcoDM »

GravityDK wrote:I just wanted to cheer for this being accepted.
I would use a subdomain to get the parallel downloads: like subdomain.mysite.com.

I believe what I've read above will allow that usage.
Apologies for my poor knowledge of phpBB inner working concerning RFCs -- did this find its way to the 3.1 release? I saw some external cdn new features that enables usage of Google for jquery and such, but I am not seeing the possibility to add a separate domain for a CDN for attachments/styles/avatars/etc.

Thanks a lot for your help!

boxrec
Registered User
Posts: 2
Joined: Mon Sep 22, 2003 4:22 pm

Re: [RFC|Accepted] Overridable imageset and theme paths for CDNs

Post by boxrec »

For me this is still the single most wanted feature. After recently upgrading to 3.2 I now have the painful task to edit all my templates yet again to change all static content to be served by the static server.

For example on this board, this dynamic apache php served image ...
http://area51.phpbb.com/phpBB/download/file.php?avatar=48350_1268240559.png
could be served from this static lighttpd server ...
http://static.phpbb.com/phpBB/download/avatars/48350_1268240559.png

The RFC has been accepted previously but no progress made. I am fed up of coding it all by hand every template change and am happy to throw in a bit of sponsorship if anyone is willing to take up the task.

Post Reply