Avatar of egoselfaxis
egoselfaxis

asked on 

How would I implement CDN functionality in a custom PHP-based CMS and application?

I currently manage a site that was custom developed using PHP/MySQL, and that's powered by it's own custom CMS.

Recently, we've been discussing the possibility of adapting the site so that it serves up the static assets using a CDN (ie: CSS files, JS files and images).  Since the header and footer of the site are static, it would be simple enough for us to adapt those elements so that they pull the resources from a CDN,  However, .. what about the CMS?  

In other words, .. how would we adapt the CMS so that when images are uploaded through the back end, .. that they automatically get pushed up to the CDN (using PHP) ?  To be more specific .. how would we handle the Add / Modify / Delete functionality of images within this context?  And would the switching over to the serving up of those CDN hosted assets on the front end of the site be as simple as specifying a simple "base href" tag in the site's global header?  Please advise.

Thanks!
- Yvan
* CMSPHP* Content Delivery Network (CDN)

Avatar of undefined
Last Comment
skullnobrains
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Who is your CDN?
Avatar of egoselfaxis
egoselfaxis

ASKER

Hi Ray.  We haven't yet chosen or implemented one. We've just been discussing the possibility of using one, as part of our ongoing efforts to improve the site's performance.  

- Yvan
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Can you please post a link to the site?  If I see anything that will help it get faster, I'll be glad to share ideas.

One such idea:
https://www.experts-exchange.com/articles/18437/Improving-Web-Site-Performance-via-PHP-Cache.html
Avatar of egoselfaxis
egoselfaxis

ASKER

Sure thing Ray.  Here is the currently unmodified "FOUC" version of the site's homepage:

https://www.evergladesholidaypark.com/

.. and here is a slightly improved version of that page with some of the elements moved around to help with the initial display when loading:

https://www.evergladesholidaypark.com/yvan.php

Thanks,
- Yvan
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of skullnobrains
skullnobrains

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of egoselfaxis
egoselfaxis

ASKER

Thank you both for your suggestions.  I've been aware for some time that the images in that homepage slideshow could use some better compression, but we were intentionally ignoring the obvious until we could find a better way to deal with the other issues.  

Regarding the CDN .. I'm getting the impression that interfacing a CMS with a CDN isn't recommended, and that it presents too many challenges.  Am I mistaken about that?  If not, then how does the image URL and filename re-writing typically get handled? Does it have to get written to and retrieved from the database?  Or is there a way to handle it "on the fly" so to speak?

Ray .. I'll be experimenting with your suggested techniques in the next day or so.  Thanks again for your wise suggestions.

- Yvan
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of egoselfaxis
egoselfaxis

ASKER

Ray -- just one more question.  What tool did you use to re-compress the JPEG images?  And what types of settings did you use?   I ask because I'd like to share that information with the graphic artist.

Thanks,
- Yvan
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of egoselfaxis
egoselfaxis

ASKER

Thanks Ray!  The graphic designer and I both already use Photoshop for compressing images, actually. I just though there might be a better, more light-weight tool that we could use.  Regardless ... I noticed that the Google PageSpeed Insights reports provides a link to download optimized versions of the images .. so that's probably the best way for us to go.  

Thanks again guys!
- Yvan
Avatar of skullnobrains
skullnobrains

any tool that can "save an image as" and let you choose the format including probably windows paint can do that. i usually use the gimp which is a free ~ equivalent of photoshop so is heavy as well. php libraries ( gd2 ) can transform images as well. i would recommend to do thumbnail generation in php. for the big images, try various compression algorithms : it is likely that gif will leave the text neater and pngs will likely be smaller than jpegs for equivalent quality... try it : that depends on the image.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo