i have problem with uploading on my own server with nicEdit wysiwyg editor.
When you clikc on upload image you will upload image on other site. Here: imgur dot com
This is it: http://nicedit.com/demos.php
I want to use them php script to upload image on my own server/domain.
Can somebody tell me how to do it?
Here is the script: http://svn.nicedit.com//trunk/nicUpload/php/nicUpload.php
Still show message "Failed to upload image".
In console on firebug show this one:
<script>
try {
top.nicUploadButton.statusCb({"error":"Invalid Upload ID"});
} catch(e) { alert(e.message); }
</script>
POST is okay but i dont understand this. :(
Have anybody som good answer for me?
Thank you very buch.
PS: sorry for my english. :)
Daniel.
Did you install the PHP APC library on your server? I think you need to generate this id.
$id = $_POST['APC_UPLOAD_PROGRESS'];
NicEditor uses imgur as the default image upload service. The source code follows the API format described here: http://api.imgur.com/resources_anon#upload
My suggestion would be to implement the API request and response defined there.
Related
guys!
I am gonna upload video file to stream of api.cloudflare using php.
I'm trying to send the following request to cloudflare.stream, but I'm getting an error: What is the accound_id value in the URL?
Help me.
Thank you...
I have an external resource for my images let's say https://api.domain.com/api/downloads/{file_id}. The file gets downloaded after I visit that page. In this case I want to know the mimetype of the file. file_get_contents() doesn't work because the file is downloaded after I visit the page.
This means that I get HTML as output when I dump the result of file_get_contents(). I don't have any hold on how images are served to my application. So I guess I have to find a solution for this problem.
Is there a way to get the mimetype of a file after the page is loaded and it downloaded the file? If something I just wrote is not clear enough please let me know then I try to explain it further. Thanks in advance.
Some more detailed information:
I am currently creating an EML export from data from an external API from Genesys. This is pure PHP and thus I can’t make use of any client-side code like Javascript. The inline images in the body don’t show on in the EML export email body. I think this is because Genesys saves those images somewhere on their side. The image is not directly available from the URL they gave to me, because when I visit that page the page downloads a file but it is not directly served on that page.
To show the images inside the email body I want to encode them to base64 and change the src of the image to the base64 encoded image. To do so I need to know the filetype which I can’t get as described above.
Did you try with the onload property on the <img /> tag ?
<img src="w3html.gif" onload="loadImage()" width="100" height="132">
<script>
function loadImage() {
alert("Image is loaded");
}
</script>
https://www.w3schools.com/tags/ev_onload.asp
You will need to use javascript as the image is on a remote server and loaded on client side
edit: To sum it all up, I wanted to see how to make a website generate a link after a file has been uploaded.
First time posting here, I hope I'm not breaking the rules by asking this, haha.
I'm trying to set up an upload function on my website by following the tutorial on tizag, but I can't seem to figure out how to make it that after uploading, the user is presented with a link to the file (like how you would upload something to imgur and receive a short link like this imgur.com/k4FzF6W ).
Thank you for your help! I'm very new to php and I'm not the best at code in general.
This all depends on if you have the button to upload and stuff BUT here is just the basics of it, since I don't know what your code is.
$fileupload = uploadedfilenamehere;
function grabLink() {
echo "site.com/".$fileupload;
}
Which would return:
"site.com/uploadedfilenamehere"
And if you need to have a directiory just change this:
echo "site.com/dir/".$fileupload;
Recently I have moved from my staging server to production server and I don't have access to any of these servers.
Both of these servers are linux.
On the new server while generating the pdf using mPDF with symfony 1.4 framework, images like rupee symbol are not getting displayed instead a small red "x" symbol is getting displayed in pdf.
Also, when I try to give background image to pdf, full image path like "http://example.com/image/rupee-image.jpg" is getting displayed instead of image.
Rupee symbol, other images and background images are working fine on my staging server.
When, I did $mpdf->showImageError(), It's saying "mPDF Image Error: Could not find image file" and pasting the url in browser displays the image perfectly.
Any help will be greatly appreciated.
mPDF is telling you that it's not finding the image.
Without seeing your code it's difficult to hint you on what's wrong.
Still you probably what to try referring to your images using a full path locally.
So instead of reference like http://example.com/image/rupee-image.jpg
use something like /var/www/mysite/image/rupee-image.jpg , same as if checking the image is there using the command line.
HTH
I had similar problem, i fixed it with replacing http:// to https://. Watch out for it.
I fixed it myself... I have created a variable in my template and then replaced that variable with image location from my action class, using $mpdf->WriteHTML(str_replace('rupee_symbol','₹',$html1));
My problem was PHP 7 in this case! I check condition
if (!empty('/images/someimg.png')) {
echo '<img ...';
} else {
echo 'error in PHP 7';
}
Be carefull using it. Version PHP 7.0.19
So, I have a little PHP code that uses Kaywa to generate and display a QR code:
echo "<img src='http://qrcode.kaywa.com/img.php?s=10&d=$qr_url' alt='QR code' />";
Easy peasy. But for the sake of having a backup, I'd like to save this image to my server, maybe in "myserver/qrbackups". I know how to make PHP upload a file from a form, but can I do from a retrieved image URL?
See file_get_contents.
$data = file_get_contents("http://qrcode.kaywa.com/img.php?s=10&d=$qr_url");
$saved = file_put_contents('/path/to/myserver/qrbackups/the-code.png', $data);
Keep in mind /path/to/myserver/qrbackups/the-code.png should be a unique file name for each individual QR code.
You can use cURL to programmatically access URLs.
http://us3.php.net/manual/en/curl.examples-basic.php
You can try to use curl or file_get_contents to pull the file from the server.
For example:
http://www.phpriot.com/articles/download-with-curl-and-php
And after getting the file just display the one you got from your server or remote.
copy('http://domain.com/path', '/tmp/file.jpeg');
should work for you. And, as others have pointed you, cURL will work too.
If you have the GD extension on your server, you can use a library like PHP QR Code to eliminate the dependency on Kaywa. Usage requires only one line of code wherever you want to generate a QR code.