Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image path issues - Social media icons are not always visible #160

Closed
mattwire opened this issue May 27, 2017 · 14 comments
Closed

Image path issues - Social media icons are not always visible #160

mattwire opened this issue May 27, 2017 · 14 comments

Comments

@mattwire
Copy link
Collaborator

Having a few issues with image paths. Running latest version on Drupal with civicrm 4.7.19.

  1. Social icons don't display in preview as it is looking for a path relative to the site root (ie. https://sitename.org/templates/versafix-1/img/social_def/facebook_ok.png).
    Workaround: Create a symlink in the site root:
    templates -> sites/default/files/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates

  2. Social icons don't display in mailing public URL (eg. https://sitename.org/civicrm/mailing/view?id=125) as it is looking for a path relative to civicrm (which won't work!) (ie. https://sitename.org/civicrm/mailing/templates/versafix-1/img/social_def/facebook_ok.png)

totten added a commit to totten/uk.co.vedaconsulting.mosaico that referenced this issue May 30, 2017
…eda-consulting-company#160)

This is not a fix - but the image handling can be fiddly, and this is a
reminder to check it before making major/final releases.
@freedomlives
Copy link

Same here-- the social icons don't work in the email or on the public mailing view.

@JKingsnorth
Copy link
Contributor

The social icons don't display in the preview because the block definition uses relative URLs:
https://github.com/civicrm/mosaico/blob/b2b271fe6f23c3393e1196a10fa9368329e5bb46/templates/versafix-1/template-versafix-1.html#L1402

The relative URLs are rewritten to absolute URLs when the mailing is actually sent though:
https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/blob/bc9d18cadf0984b427f533378451996b93229939/CRM/Mosaico/UrlFilter.php#L34

@mattwire
Copy link
Collaborator Author

See PR #182 for social icons fix

@totten totten changed the title Image path issues Image path issues - Social media icons are not always visible Nov 29, 2017
@totten
Copy link
Collaborator

totten commented Nov 29, 2017

As noted in the PR, I've been unable to reproduce the problem. Can anyone say if they still have the problem -- or if there's an important difference in environment/settings?

@mattwire
Copy link
Collaborator Author

@totten Give me a couple of days and I'll do some testing

@mattwire
Copy link
Collaborator Author

mattwire commented Dec 2, 2017

@totten I've just tested with the latest HEAD on 2.x and I'm still seeing images fail at the first hurdle:
New mailing->Edit->Add social media block->Preview->As HTML->Social icons not shown:
civicrm-demo mjwconsult co uk_civicrm_a_

CiviCRM 4.7.27, shoreditch:master, mosaico:2.x flexmailer:master.

@agileware-fj
Copy link
Contributor

For what it's worth, we were seeing this problem a while back, but with mosaico 2.x branch, social icons are now displaying correctly and have absolute URLs in each of the 4 scenarios.

The entry in the civicrm_mailing table actually has the absolute URL to the social icon / any uploaded image, so it seems this is done client side.

For reference, I've been testing on CiviCRM 4.7.29 on Drupal 7.

@jmcclelland
Copy link

It is now working for me too.
I think I see why this problem may be so hard to reproduce.
When I choose the default versifix-1 template, the social media icons work as expected in both the preview and in the delivered email.
However, when I sent via a template that is based on versifix-1 that was made in a prior version, the links were in the form:
https://ptp.ourpowerbase.net/templates/versafix-1/img/social_def/twitter_ok.png

Instead of:
https://ptp.ourpowerbase.net/sites/all/extensions/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/versafix-1/img/social_def/twitter_ok.png

I tried deleting and re-creating the social icons block in the bad template and got the same result.

When I trashed my existing template and rebuilt it, the icons started working properly.

@jaapjansma
Copy link
Contributor

I have updated the mosaico extension from 2.0-beta2 to 2.0-beta3. I have also migrated the templates. I discovered that with the old templates the social icons are still broken but when I use a new template the social icons are fixed.

@MarshCastle
Copy link

Is there any chance of this being fixed on v1.0?
v2.0 seems a long way off being "Stable" (with the two dependancies being stable too) - so I'm after something that has a bit more of a guarantee on it for use on sites with sensitive data.

@jmcclelland
Copy link

My experience (which is confirmed by the last few posts) is that this issue is fixed and should be closed.

Since the release is still beta, I don't think it's worth the effort to try to fix templates that were made in previous versions.

I think it's acceptable to tell people: If you are experiencing this bug and you are using a template made with a previous version, delete your template and re-create it from scratch.

@totten
Copy link
Collaborator

totten commented Jan 25, 2018

Thanks @jmcclelland @jaapjansma. I really like how this explanation is able to address the different experiences ("works for me", "doesn't work for me"). 👍

It'd be great if one of the earlier participants here (like @mattwire) could re-test. Absent contradictory info, I'm also inclined to close.

@mattwire
Copy link
Collaborator Author

@totten I've now had the opportunity to upgrade two sites from my version of the mosaico extension to the latest master (beta4). I'm pleased to say that on new templates there are no image path issues, and I can "fix" the old templates by editing them directly in the database to ensure they all have full rather than relative URLs.

So, if we can add a note to the README or something that image path issues are caused by templates created with an older beta version and they should delete/recreate them then I think we can close this.

@totten
Copy link
Collaborator

totten commented Feb 16, 2018

Woot! @mattwire

We could potentially kick the can down to the 2.0-final release announcement.

IMHO, the README.md is due for a reorg -- e.g. I think the main README should basically be:

  • A screenshot
  • A brief, 1-2 sentence description
  • A bulleted list of sub-documents ("Introduction", "Installation", "Development").
    • Notes about social-media icons and upgrades could go in a page for "Troubleshooting" or "Upgrading"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants