One example with Lightbox but could be reproduced for others tools.
We use 2 pictures : small one and big one which will be visible thanks to Lightbox.
Small one uses
tag.
==> this one is correctly replaced by Parallel module
Big one uses tag.
==> this one is not replaced by Parallel module
To solve it I think we must edit parallel_image_replace() function to make its pattern looks for "src" and "href" tags. But how to recognize in href URL there is really an image ?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | file.patch | 924 bytes | ball.in.th |
Comments
Comment #1
srobert72 commentedOther solution could be to give us function with2 parameters : URL and type (img, js, css).
Someting like parallel_replace_url($url, $type)
Then we use it to replace our URLs before to write them in our templates when we know its an image.
This solution isn't as nice and global. But it's a simple one.
Comment #2
ball.in.th commentedI was just trying to get parallel to work with lightbox images. Perhaps patching the core file_create_url() could be used for this.
Comment #3
srobert72 commentedI think this patch will not perfectly work.
It replace all URL from /files directory with Parallel IMG alias even if that's not an image.
Comment #4
srobert72 commentedIn my theme file : template.php
I created this function :
And I use it this way :
cdn_url($url) is used same way as url($url) : http://drupalcontrib.org/api/function/url/6
I use cdn_url($url) in my template when I construct Lightbox tag manually. It works.
But it doesn't resolves problem when Lightbox tag is constructed by Views for example.
EDIT:
Sorry Parallel module works for automatic Lightbox tags in Views with Lightbox rendering image.
So my problem was just for Lightbox tags generated manually in template.php.
In this case using cdn_url($url) solves my problem.
Comment #5
mikeytown2 commentedReplacing lightbox images is sorta overkill, unless your using this as a true CDN. Thought on how to tackle this?
@srobert72
You have an interesting idea, I should include your function; but have it take 2 parameters: $url, $domain. $domain can be img, css, js.
Comment #6
srobert72 commentedSimilar problem with ColorBox module.
See #773006: Add support for the Parallel module
Comment #7
Andrew Udvare commentedMeh, I strongly suggest some drupal_alter()'s in these replacement functions for fixes so we don't have to hack 'core' (parallel.module) so to speak.
Comment #8
wim leersWill be obsoleted by #933942: Merge Parallel and CDN modules: migration path.