How To make Some Text In a whatsapp message as link - php

I want to make a particular text as link in whatsapp text so that it can be copied rather then coping full message i just want that particular text to get copied as in the screenshot : https://prnt.sc/taago5 you can see that its blue in color that means its like a link when long pressed it gets copied.
similarly i want the text in red box as link so that it can be copied : https://prnt.sc/taahd4

You simply can not make just any arbitrary text you want, become a link. There is no mechanism or syntax provided to achieve this.
WhatsApp parses the message content, and replaces parts that match certain patterns with links automatically - for example HTTP/HTTPS URLs.
What your first screenshot shows, 544-497-293, gets recognized as a (potential) phone number here, and that is why it gets transformed into a link automatically.
But you won’t be able to force this in any way, for the arbitrary format you have in your second screenshot.

Related

Wordpress: Converte specific Links in Backend-Editor with Link Tool

I am looking for a way to loop the links to be inserted beforehand and generate to a specific link. The links are recognized and converted based on their domain, I have already managed that. Unfortunately, I don't know how to insert a small button there and then send the selected link through the loop accordingly.
I don't know what is easier to implement:
1 possibility:
Link is converted directly when inserted
enter image description here
2nd possibility
Links are inserted and then you click on them and you have a small field with the converter.
enter image description here
I thank you!

Str_replace issue when using html

I am trying to build a system where users can edit news stories. When they add images to the stories they will type #IMG1# if it is the image with id 1 they want in there.
When they upload the news, the #IMG1# code is str_replace() with something like this: <div id="image"><img src="images/image1.jpg"></div>
The issue for me is when they want to edit the news again, I want to replace all the image codes back, so the user sees the #IMG1# again, but it seems I cannot str_replace() back because of the html codes and the quotation marks? Is this true?
Is there a way to fix this?
I advise to leave news' text as is, with #IMG1# placeholders.
Only when you output this text for viewing - replace #IMG1# with <img> tag, but when user edits text - he still sees #IMG1# and can edit it.
Of course, as you will replace #IMG1# placeholders on each output, this can slower your system. As a solution - you can add additional field like renderedContent and on saving data render news text to this field and when output for viewing - take content from this field.

How to generate random embed image url

I'm trying to hide my image url including dir path. I tried base64 but it always shows the same url, I need a different one everytime I hit refresh. I then tried to create a temporary one using tempnam, but it only adds some characters at the end of the link and don't change the dir path.
I also tried createimagefrompng but it gives me either my website with no picture, or just a picture of a white frame.
When my player goes on the page, the page generate a random number from 1 to 5 and letter A or B, go in folder "A" or "B" and search for the picture with the generated number in that folder.
The Problem is the picture url is images/A/1.png, I want it to be random so he can't use a script to refresh until he gets A/3.
And I want it to be different everytime because he could find A/3 embed url and use the script to find that embed url.
Thank you!
Jessie
Ok managed to finally make it work!
I'm using a mix of things I've already tried.
So first the base64encode was great, but it always had the same url which I didn't want.
So I searched on how create a new encoding that I could make random and found that code: https://gist.github.com/LogIN-/e451ab0e8738138bc60b
I then generate a random key and encode the image link using that random key.
I then call an php image using createimagefrompng and put the key and encoded image link in the php url (www.example.com/image.php?encoded=jsnda9d9832rm&key=emd39023)
And then in that php decode the url using the key and show the image ^^
Hope it can helps other, also if you see something I could change so my code will be lighter or have better performance please don't hesitate :)

PHP: Generate QR Code with some descriptive text beside or below it

Well, I was able to generate a QR code (dynamically) using http://phpqrcode.sourceforge.net/ API.Now, I am stuck with another requirement where I need to add some text beside or below the image, describing the use of this QR code like say "SCAN ME for more offers!!". I wish to add company logo on that text too.
Is there an way to do, beside image manipulation api in PHP?
If you are displaying the QR codes on a web page, just add another div with the logo and or text. If your goal is to produce a single image you can download and you want to produce it from your script you can use http://image.intervention.io/
It is still an API based implementation. If you can clarify what you want to avoid and why and your end case I might be able to offer some other suggestions.

Need some help in downloading pics from a website

I am looking for some help in downloading pics from a website. Here is the problem detail.
URL is basvandenbroek dot com,
suppose when we visit the following page http://www.basvandenbroek.com/nl/product/27341/704/snaarinstrumenten/boston/snarenset_elektrisch.html
we have a thumbnail pic here which when click bring its larger version. I would like to capture the larger image using a php script and download it onto my pc.
Problem is when we inspect the HTML we see the following code for images
../../../../../../../jpg/27000/27341.jpg
../../../../../../../jpg/cache/27000/220_220_27341.jpg
Based on the above code i assume that if i append website address at the start of the
jpg/27000/27341.jpg I could access the pic but its not working it that.
I believe URL is hidden or I might not understanding things properly. I am new to PHP and Scripting and I would like somebody to help me through it situation.
Thank you
For the website you mentioned, if the thumbnail is
http://www.basvandenbroek.com/jpg/cache/27000/220_220_27341.jpg
then the
http://www.basvandenbroek.com/jpg/27000/27341.jpg
So the thumbnail is basically the dimensions (220 x 220) added as a prefix to the original in a different folder. Also, there is nothing like hidden URL. Any link that is valid on a web-page is sure to appear in the source of the html. In chrome and firefox, atleat, you can find this link by right-clicking the link and copying the link address.
In your case you can find the thumbnail's url by right-clicking the thumbnail and the original's url by right-clicking it.
However, if you want to do this automatically using PHP, you will have to write code that can parse the html for the page to determine the urls.
In your example, here would be the larger image:
http://www.basvandenbroek.com/jpg/27000/27341.jpg
The smaller image is at:
http://www.basvandenbroek.com/jpg/cache/27000/220_220_27341.jpg
This means you would need to scrape out the first two underscored parts of the name (220_220) using string manipulation. You would also want to string replace "cache/" with an empty string.
relative urls are relative to the url of the containing document. so if the document you're scraping is located at http://example.com/foo/bar/baz/doc.html, and the image is referenced as
../../omg/wtf/lol/cat.jpeg, its full url is http://example.com/foo/bar/baz/../../omg/wtf/lol/cat.jpeg, or http://example.com/foo/omg/wtf/lol/cat.jpeg.
btw, this has nothing to do with PHP or scripting in general, and is instead firmly a HTTP thing. and there are no "hidden" URLs in HTTP, that would be a contradiction.
edit: your comment makes it look like the problem is with the Referer header or session id sent (or not) in your request.

Categories