Email template issue uploading images

I think that this problem may have started to happen when I made an upgrade from 7.10.1 to 7.10.10

I was creating an email template last night and when I tried to add an image an entry appeared in Documents at the bottom of the form, but I wasn’t able to complete the upload and the image. I am wondering if this could be a permissions problem on the upload folder caused during the installation.

In the end I made a temporary fix by using images from another server, but it would be useful to solve this.

Thanks.

You can check your logs for any errors.

Is it a big image? What file type does it have?

Also check your upload folder, to see if the file gets saved there (with an id, not the original filename, but you can tell by the date and by the size if it’s the same image).

I have had a look at this. Now, I bumped the log reporting up to error and repeated the upload attempt. No evidence in the system log.

I have had a look in the download folder on the cloud server and there are what look like about 20 uploads. This is similar to the number of attempts I may have made. What is odd is there are no file suffixes to these files. I uploaded .jpg and .png in my attempts.

The files have IDs like this - f64902a7-f802-a105-7dcd-5be165ad526f

I can see .csv files that I uploaded which have their suffixes.

You can read this for some background

https://pgorod.github.io/How-Photos-Stored/
https://pgorod.github.io/How-Attachments-Stored/

That is useful. I can see that images are uploading but they appear to be creating attachments rather than images.

When I hover over the attachment link at the bottom of the message it shows one of the long IDs but at the end &type=notes which doesn’t look right.

To be clear the whole process I am going through is:

In the mosaik editor click insert/edit image, this gives me a dialogue where I see Source and a folder search icon.
I click this and it opens the windows file browser.
I navigate to a file and select it.
It appears in the attachments listed for the file, there is nothing in the message body, not even a broken link - checking the source code the is no image tag not even an empty one.

Before the upgrade I had successfully uploaded images. I am running two different installations now both on 7.10.10 on different Centos 7 cloud servers both behave this way.

I wanted to post a screen shot, but the add attachments button doesn’t appear to do anything. Tried in Chrome, IE and Firefox.

I should add that I think when I went through the upload process before I think the source URL was filled in after I had selected the file in the windows browser.

It remains empty after I have picked the file.

You can upload screenshots here

https://pasteboard.co

The “notes” doesn’t seem wrong to me, attachments are notes.

I suggest a test where we avoid some of this complexity, to see if there is an underlying issue.

Create a new Note anywhere (not related to any email functionality), and add the same image file to it. Then check if you can download it correctly, and compare the URL with the one your email attachment was generating (by the way, which is it? please paste it here in full so I can look at it)

Okay I am getting somewhere!

Here is my screengrab: https://pasteboard.co/HNh4696.jpg

This is what I see after I have added an image ie. there is an attachment, which is now stored in the CRM, but nothing is added to the message body.

Before I go on can I say this is really helpful.

As you have suggested a note is being created which contains the image as an email attachments. If after the note is created I navigate to is open it and right-click copy link into the clipboard I can then paste this into the source field in the message and the image appears. The dimensions are also filled in correctly.

I’m sure I remember before that the source was automatically filled after upload rather than having to find the note and copy in the link. But at least for now this works as a workaround.

Can you spot a difference between the link that works and the one that doesn’t?

You might have to go in the database to see the link that doesn’t work, how it is saved in the email_templates table, if it isn’t shown in the browser. But probably in the browser’s Developer Console you can see it somewhere in the HTML.

Here is an example of the link to the note that was successful

http://crm.littlebritain.co.uk/index.php?preview=yes&entryPoint=download&id=7aa2d34a-0493-4234-83d7-5bed61a39458&type=Notes

I can paste any note link generated either by creating a new note, or by inserting an image and then getting the link from the notes panel and it is successful.

I think the only thing that isn’t working now the source field being filled at the time of upload.

I’d really like to compare that URL with the one that doesn’t work. When you add the image in the template, and it doesn’t show, can you find what the URL that is generated for it?

http://crm.littlebritain.co.uk/index.php?entryPoint=download&id=96a9dcd0-9de1-1db6-6a01-5bed6713512a&type=Notes

I’ve realised that this is an internal link so it brings the view to the login screen.

There is nothing in the message body when I’ve tried to insert the link this way.

Immediately after I have uploaded the link things look like this shot from pasteboard.

https://pasteboard.co/HNhrG26.jpg

I tried a few things with Mozaik and the conclusion I am reaching is that Mozaik doesn’t really handle images from Windows (or any other local file system), it just seems to let you specify a path on the server.

When I add a pre-existing image, giving it the server path, it seems to recognize it.

I am not sure if this is a bug or a limitation that was always there. I normally use MCE, not Mozaik…

I was able to insert an image like this:

  1. Click insert image, select an image from Windows
  2. It doesn’t show in the template, and the file doesn’t appear on the server (upload dir), but it does appear as an attachment under the template
  3. Click Save, even though the template is not finished yet
  4. The file appears on the server, as upload/683771af-32fd-780f-fa66-5bed9c759cde
  5. Click to edit the template again
  6. Click to edit the broken image, give it that path upload/683771af-32fd-780f-fa66-5bed9c759cde
  7. Now it shows!

How’s that for “user friendly”? :stuck_out_tongue:

Thank you again, I’m getting there. This works within the platform, but when I send a test email the image link in the test email is truncated.

As an aside I wanted to use the other option editor (TinyMCE) but it didn’t have an image link button at the bottom.

Looking at the source code of the email it would appear that the link is truncating the address so all I am left with is

upload/63450c31-ebd9-45d1-baab-5bed5c7b6ff3

If I put the whole address into a browser the image is there.

http://crm.littlebritain.co.uk/upload/63450c31-ebd9-45d1-baab-5bed5c7b6ff3 - this works on any browser even if not logged in as a user.

One option for me is that we just upload images to our wordpress site and then link to there, do you think this would be a better approach?

Do you have your site name correctly set up in config.php?

Please check

site_url
host_name

Hello, did you resolve this issue? I have the same problem.

Checking some similar at /modules/AOS_Products/AOS_Products.php

When construct the path of file, it uses: $sugar_config[‘site_url’]

Check for ‘site_url’ in /config.php and change ‘http’ to ‘https’.