osCommerce embedding image in email [closed] - oscommerce

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
the following script does not embed image in the email. Instead it removes the src attribute of the img tag:
require('includes/application_top.php');
//include(DIR_WS_CLASSES . 'mail.php');
$img_url ='<div style="border:1px solid black; padding:5px;"><img src="http://spottheball.designers99.com/images/logo.png" /></div>';
$contents = $img_url;
$contents .= '<div style="padding:4px; border:1px solid red; background:green;font-size:50px">A test text</div>';
$m = new email(array('X-Mailer: osCommerce Mailer'));
$m->add_html($contents);
$m->image_types = 'png';
//$m->headers[] = "Content-Type: image/png";
$m->build_message();
$add_to = 'horizontechnalogies#gmail.com';
$m->send('Shahid', $add_to, 'Omar', 'spottheball#gmail.com');

Gmail block images by defualt when clicks the download link images are downloaded and displayed. So i did so and images got displayed.

Related

I'm pulling a dictionary from an API call, when I pull URL information it quotes and brackets around them [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm pulling the website information using a call in my Django template. All the information is getting pulled, but when I pull the website it has quotes and brackets around it like '[https://xxxxx.org]' obviously when I create the <a href=>{{ web.site }}</a> tag around it, it can't browse to the site.
Is there a quick way to strip off all the extra '[]' around the URL?
I figured it out, those were all good ideas, but what was happening was I was pulling from a dictionary with an embedded list.
'data': {
'BTC': {
'urls': {
'website': ['https://bitcoin.org/'],
'technical_doc': ['https://bitcoin.org/bitcoin.pdf'],
'twitter': [],
'source_code': ['https://github.com/bitcoin/']},
'logo': 'https://s2.coinmarketcap.com/static/img/coins/64x64/1.png',
'id': 1,
'name': 'Bitcoin',
'symbol': 'BTC',
I was only accessing up to the dictionary item:
{{ data.BTC.urls.technical_doc }}
Which was returning the list:
['https://bitcoin.org/bitcoin.pdf']
To get the item I wanted inside the list, I had to add a "0" at the end to snatch out that list item:
{{ data.BTC.urls.technical_doc.0 }}
Which in turn pulled the item out of the list clean.
https://bitcoin.org/bitcoin.pdf
Thanks for everyone's help, but it was my own misunderstanding.
i think this is what you need:
string.strip
string = "'[https://xxxxx.org]'"
# strip: Remove specific characters at the beginning and at the end of the string
print(string.strip("'[]"))
# Output: https://xxxxx.org

Remove HTML Comment Tags from text [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm really struggling trying to remove comment tags from HTML.
I want to keep everything inside the comment tags. I just want to remove <!-- and --> from the text.
I'm writing code using Python 2.7 and BeautifulSoup4.
I've tried using Regex to no avail. I tried the pattern "(<!--.*?-->)", but this seems to remove everything inside also.
I've also tried "(<!--|-->)" but it did not do what I wanted.
How can I achieve this?
you can use re.sub:
import re
f = open('filename.txt', 'r').readlines()
for n in f:
text = n.rstrip()
othertext = re.sub('<!--', '', text)
f = open('saved.txt', 'a')
f.write(othertext)
f.write('\n')
You can Just Group the Comments tag and replace the remaining data in the file
import re
List = "C:\\Users\\Administrator\\Desktop\\File1.txt"
with open(List,'r') as readfile:
content = readfile.readlines()
for i in content:
if '!' in i :
line = re.sub('(\<!--)([\w ]*)(-->)',r'\2',i)
with open('C:\\Users\\Administrator\\Desktop\\File2.txt',"a+") as writefile:
writefile.write(line)

Interpreting A Regular expression [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 4 years ago.
I am new to Regular expressions and I came across this piece of code in Wordpress but I have failed to understand what's going on, despite the comments. Kindly help me figure it out.
// catch base url
preg_match('/href="(.+?)"/i', $content, $matches);
$baseref = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
// get the first image from content
preg_match('/<img.+?src="(.+?)"[^}]+>/i', $content, $matches);
$img_url = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
Here's what $content contains.
<![CDATA[<p>Buganda Road Chief Magistrate James Mawanda Eremye has released Makerere University administrator Edward Kisuze. The suspended administrator is accused of sexually harassing a student. Court told Kisuzze to pay cash bail of Shs2m and each of his three sureties Shs10m.</p>
<p><img class="alignnone wp-image-32386" src="http://matookerepublic.com/wp-content/uploads/2018/04/kisuze-300x175.png" alt="" width="680" height="396" srcset="http://matookerepublic.com/wp-content/uploads/2018/04/kisuze-300x175.png 300w, http://matookerepublic.com/wp-content/uploads/2018/04/kisuze-696x405.png 696w, http://matookerepublic.com/wp-content/uploads/2018/04/kisuze.png 720w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>However, before releasing him the magistrate ordered the prosecutor to disclose to the defence the evidence to enable commencement of hearing of this case come <span data-term="goog_350196878">May 28 2018</span>.</p>
<p>On April 14, police arrested Kisuze after a viral picture of him kissing the student’s private parts in office was released online. On May 4<sup>,</sup> he appeared before court and was remanded to Luzira prison after pleading not guilty to charges.</p>
]]>
The first one /href="(.+?)"/i is used to extract the href property from an a tag.
Check out the live example: https://regex101.com/r/84dhEk/2 (the green part is the matching one)
The second one /<img.+?src="(.+?)"[^}]+>/i is used to extract the src property from a img tag.
Check out this example: https://regex101.com/r/SOPN5I/2

Shiny - how to center and fix width of dashboard

Hello R Studio Community,
I've been developing an app in Shiny and it's be great. I have one simple question.
As different browsers have different widths, is there a way to set the rule on resizing the Shiny dashboard based on the following:
1) If browser width is more than x, limit to width to x and center the entire dashboard
2) If browser width is less than x, follow default autosizing
3) Not essential. But how do I set the blank space color to the left and right of the dashboard
The motivation is that I need a fixed width so that some pictures are scaled correctly. I hope my request can be done through some div tag on the dashboardPage.
This is the current behavior which I do NOT want.
Shiny dashboard stretches to fit window
Cheers,
Donny
Hi to achive what you are asking for just add the following code to the beginning of your dashboardBody. something like this
dashboardBody(
tags$head(
tags$style(
"body{
min-height: 611px;
height: auto;
max-width: 800px;
margin: auto;
}"
)
),
... #the rest of you ui code
hope this helps

Bootstrap3 Typeahead - Empty message [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I didn't understand how to make it appear the "empty" message in bootstrap3 typeahead. I am using the custom template but what value must be assigned to source to make it appear?
Here is my code (not working):
<script>
function doSomething() {
var states = [];
$("#test").typeahead({
source : states,
minLength: 3,
templates: {
empty: ['<div>',
'No Items Found',
'</div>'
].join('\n')
}
});
}
</script>
[...]
<body onLoad="doSomething();">
<input class="typeahead" type="text" id="test">
</body>
I confused typeahead (https://github.com/twitter/typeahead.js) with bootstrap3 typeahead (https://github.com/bassjobsen/Bootstrap-3-Typeahead).
The question is wrong because the code above is correct for https://github.com/twitter/typeahead.js, instead I had included https://github.com/bassjobsen/Bootstrap-3-Typeahead, which is a different library and have different options.