Preventing file path from being added to Data URI

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
9/11/2012 5:27:24 PM
Gravatar
Total Posts 92

mojoPortal Hosting & Design @ i7MEDIA!

Preventing file path from being added to Data URI

Is there a way to keep the file path from being added to a data URI in css files?

Here's an example of what I need to happen:

.headliner {
	background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAANUlEQVQokWNksFvwnwENsDD8+4MuxsDC8O8vFsH/2ASxaseukmjB/xQ6ifruZCTe76NBhwIAR307xqwlkPoAAAAASUVORK5CYII=);
}

 

And this is what mojoPortal does naturally:

.headliner {
	background: url(/Data/Sites/1/skins/[skin-name]/data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAANUlEQVQokWNksFvwnwENsDD8+4MuxsDC8O8vFsH/2ASxaseukmjB/xQ6ifruZCTe76NBhwIAR307xqwlkPoAAAAASUVORK5CYII=);
}

The bolded area is what I need keep the css handler from adding to the URI.  Is there a way to do this?

Thanks,

-Elijah

 

9/12/2012 2:47:25 PM
Gravatar
Total Posts 18439

Re: Preventing file path from being added to Data URI

Hi Elijah,

I don't have an immediate fix for you but I did just fix this in my copy so it will be fixed in the next release of mojoPortal which should ship later this month.

Thanks for bringing it to my attention.

Best,

Joe

9/12/2012 2:53:13 PM
Gravatar
Total Posts 92

mojoPortal Hosting & Design @ i7MEDIA!

Re: Preventing file path from being added to Data URI

That's awesome Joe, thanks! :)

Will that work for inline SVGs as well? Here's a quick sample of what that looks like (it's real close to the standard URI):

background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzFlNTc5OSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzI5ODlkOCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUxJSIgc3RvcC1jb2xvcj0iIzIwN2NjYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3ZGI5ZTgiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);

Thanks again. :)

9/12/2012 2:57:49 PM
Gravatar
Total Posts 18439

Re: Preventing file path from being added to Data URI

yes it should work with anything using base64 strings to represent the image, my fix was to check if it has "data:" and if so not to try and resolve the url base.

You must sign in to post in the forums. This thread is closed to new posts.