How to show uploaded files in uploadcare? - php

I'm using uploadcare.com to store my images and files. I just started using it now. I was just wondering that how can i display the uploaded files in a web page. I looked through the documentation too. But didn't get anything to start with?
Is there anyone who have used it?

As per documentation, all images are available via CDN URL (this URL is returned by widget, it's up to you to save it). To add an image to your page just add an img tag:
<img src="http://www.ucarecdn.com/5651bbb6-c599-44bd-9c63-1db5e67db6ad/" />

Related

Secure files and display them as well

My question is about HTML and PHP.
This is my setup right now:
A website where user have accounts
A FTP server with pictures (currently none)
Files are currently saved on the website in the "PICTURES" folder (which is accessible by everybody who know the full URL)
So, I would like to know how I can display the images without storing them on the website (which will fix my URL problem).
My idea was to move the files on the FTP server, and when a users logon and request a page with those images, download them through a FTP connection, save them on the website, display the images, and remove them. Which would make them accessible only between the downloading time. But this solutions sounds REALLY bad to me.
You need always to have a place where your images are stored. But, if you don't want to give a user the chance to know where are stored, you can create a system which is used to show the images.
Think about this, if you want to download a file from Mega, you can't access to the URL where the file is stored, instead of that, the server itselfs calls a system who assign you a "key" and you can download the file only through that system using your "key".
You could use a system like "base64" so you can encode your image, and show it using it, or, you can use the "header" modifier so, you can display an image using a PHP code.
For example your image tag will be like:
<img src="processImage.php?id=01&user=10&key=123" />
So, your processImage will return a "tricky" image, actually not the image, but the code processed by PHP will be returned, like using "imagejpg()" function with the header "Content-Type:image/jpeg" and then the user will not know where the image is stored actually but the img will works actually.

Dropbox get public url of the file after upload

Need to upload files to dropbox and get the public url of that file. I'am generating thumbnails and need to show that in my site. I should also show the original files to users without login to the dropbox site.
After uploading to dropbox I need to get the original file url which will be used by crocodoc api viewer.
I could able to upload the file and I am getting the metadata of that file. I created shared url and given that url that url img tag in html but seems returning as html instead of image.
I have gone through similar questions mentioned in SO but almost all are referring old documents.
I found this trick earlier and thought I'd share.
Go to: https://www.dropbox.com/home
Then, highlight your mouse over an item, click on share.
This will popup:
Simply change:
https://www.dropbox.com/s/io9oz94lgm2j2bb/loadingscreen.jpg?dl=0
to
https://dl.dropbox.com/s/io9oz94lgm2j2bb/loadingscreen.jpg
Replacing the www with dl, to get the direct, public url.

ckeditor, php, image display issue

I have a download.php file to display images on a web page as well as downloading files like pdfs, docs, etc.
in ckeditor if the src for the image is /download.php it dispalys like there is no image or broken link image, if the src for the image is http://www.mydomain.com/download.php my image displays just fine in ckeditor.
Any thoughts? And no i cant just make it put the full domain. There is a reason to long, complicated, and stupid to explain thanks to the web hosting company.
In the configuration you need to set the baseHref to the full path, then it will add that to the images/files you upload and insert.

Is it possible to not expose my directory where I upload images?

In my website people can upload their photos. And I show them. Is it possible, that they would not be able to see url where that image is?
Photos are shown like this <img src="http://mywebsite.com/my_images/image_name.gif" />. What I want to do, that people couldn't see that src link. Is there any way to show photos from that directory without exposing directory name?
Thanks.
There isn't, but you can use URL rewriting (apache's mod_rewrite or a custom PHP script to serve the images) to hide the actual location on your web server.
For example for the latter approach you coud have a serveimage.php on the server, which is called like serveimage.php?file=file1.jpg.
You can call another php-script via <img src="..."> the script loads the image and generates it. This FAQ entry should help.

Image Preview using AJAX in PHP

How should i create a preview of image to be uploaded before it is actually submitted using AJAX in PHP?
Without uploading the image, this is going to be impossible in JavaScript as far as I can see, because security limitations are going to prevent you from determining the selected file in the file upload, and embedding that file in an img tag (as it used to be possible five years ago.)
You will be more lucky with Flash-based uploaders. I have seen some that offer the kind of functionality you want.
Update: Here's one that offers a preview function. From what I can see, it base64 encodes the local image and serves it to the surrounding HTML page as a inline data <img> tag. This is great because it might integrate well into your site. It does not work with any version of Internet Explorer, though.
Here's a fully Flash based solution that does previews in all browsers.
you first have to upload the document to server. Than you can show like.
<img src="uploads/file1_12224.jpg" />
The "file" input type doesn't expose the local file location of the file to be uploaded. It does "appear" to because as a user you can see the location, but the web page never knows this value. Without the local file address, you can't show a preview of the image on the web page using plain HTML or JavaScript.

Categories