🏢 Looking for a Swift or Laravel developer? I am currently looking out for new opportunities!

Photoshop practice and images on the blog

January 15, 2013

🕰 Feeling nostalgic? This is a post from 2013, which means I was still a student during this time. Most of my posts from this timeframe are related to school or the fiction I was writing. These might not mean much to you.

This little guy we have as a template for our Photoshop exercices has kept me busy for quite some time (several hours) today:

A Photoshop exercise I had to make.
A Photoshop exercise I had to make.

After practice today, I thought it was time about thinking about images on this blog. There’s only one issue, if you get the content dynamically, your reference to your image needs to be relative to the position from where you’re getting it. You need the path. I found a solution! Use a specific set of characters in your string, and then replace those characters with the correct path when loading the item. In the case of this blog, check out what I did:

var articleContent = imgSupport.replace(/rel-imgpath-/, _rel_img_path);

Yes, that’s a string called rel-imgpath- which can be set to whatever I please. In our case, it is the src path to the image. So if you ever want to load this dynamically, you can by replacing the part of this string so that it matches the (relative) path to the images folder. Of course, since the string gets replaced as long as it is in the article (which it is, right now!), I gave it a slightly different name here.

Tagged as: Programming