The email template from the SubmitContent form looks like this:
If the user included a picture in their content item the URL will be a relative one like this:
And obviously the picture doesnt show up in the email.
Is there any way to change URLs in the email only to absolute ones like
I guess this would have to be some sort of mambot / plugin?
<p>Hi,</p>
<p>New user has submitted a new Content item, please review it!</p>
<p><strong>Title:</strong>{title}</p>
<p><strong>Body:</strong> {fulltext}</p>
If the user included a picture in their content item the URL will be a relative one like this:
<img src="images/stories/jbudd/blacksheep.gif">
And obviously the picture doesnt show up in the email.
Is there any way to change URLs in the email only to absolute ones like
<img src="http://mysite/images/stories/jbudd/blacksheep.gif">
I guess this would have to be some sort of mambot / plugin?
Hi jbudd,
The image links are in the $attachments array so you could change them in the OnSubmit Before box to add the site prefix. It woudl be something like
Bob
The image links are in the $attachments array so you could change them in the OnSubmit Before box to add the site prefix. It woudl be something like
<?php
foreach ( $attachment as $k => $image ) {
$attachment[$k] = JURI::base().$image;
}
?>
I'm not sure I've got the slashes correct but you can fix that.Bob
Thanks for such a quick response Greybeard. Glad to see I'm not the only one working on Sunday :wink:
I put this in the Before Email code
I would expect it to change the attachment URL in the content item - fair enough, I can strip the URLs in the After Email code...
but in fact it doesnt seem to do anything.
I presume that my images are not in $attachments.
Here is a real example of the item contents:
One way to do it might be to add a function to the email code ie
but where do I define the longimagesrc() function?
I put this in the Before Email code
<?php
foreach ( $attachments as $k => $image ) {
$attachments[$k] = JURI::base().$image;
}
?>
I would expect it to change the attachment URL in the content item - fair enough, I can strip the URLs in the After Email code...
but in fact it doesnt seem to do anything.
I presume that my images are not in $attachments.
Here is a real example of the item contents:
<p>Testing Testing</p><img alt="blacksheep" src="images/stories/jbudd/blacksheep.gif" width="290" height="300" />
One way to do it might be to add a function to the email code ie
<p>Hi,</p>
<p>New user has submitted a new Content item, please review it!</p>
<p><strong>Title:</strong>{title}</p>
<p><strong>Body:</strong> <?php longimagesrc($_POST['fulltext']) ?></p>
but where do I define the longimagesrc() function?
Well I tried this email template:
and the email is blank after Body:
More experiments needed....
<p>Hello admin,</p>
<p>{username} has submitted a Year 6 News item, please review and publish it!</p>
<p><strong>Title:</strong>{title}</p>
<p><strong>Body:</strong> <php? echo preg_replace('src="images/stories', 'src="mysite/images/stories', Jrequest::getVar('introtext'); ?></p>
and the email is blank after Body:
More experiments needed....
Hi Jbudd,
Just spotted <php? - should be <?php . . . and you are correct, it should be $attachments (plural) not $attachment as I wrote it.
Bob
Just spotted <php? - should be <?php . . . and you are correct, it should be $attachments (plural) not $attachment as I wrote it.
Bob
Just spotted <php? - should be <?php
Hmm, i made lots of dumb errors in that tiny bit of code!
Thanks again.
This is only necessary because of a bug (?) in chronocontact.php not including the base URI in the email header.
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=3&t=13313
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=3&t=13313
This topic is locked and no more replies can be posted.