Php hide image path

Source: Internet
Author: User
The entire process is asynchronous phpfunctionhideAvatar () {ob_clean (); $ filefile_get_contents (url); the url here is the real path of your image echo $ file;} htmlimgidimgimgjsLoadImage (img ); functionLoadImage (ElementID) {id requested image IDvarurlxxx

The entire process is asynchronous php function hideAvatar () {ob_clean (); $ file = file_get_contents (url); the url here is the real path of your image echo $ file ;} html img id = img/img js LoadImage (img); function LoadImage (ElementID) {// id requested image ID var url = http: // xxx

The entire process is asynchronous.

Php

Function hideAvatar (){

Ob_clean ();

$ File = file_get_contents (url); the url here is the actual path of your image

Echo $ file;

}


Html


Js

LoadImage ("img ");


Function LoadImage (ElementID)
{
// Id of the requested image ID
Var url = "http://xxx.xxx.xxx/hidehideAvatar? T = "+ Math. random ();/
Var xhrObject = new XMLHttpRequest ();

XhrObject. onreadystatechange = function event ()
{
If (xhrObject. readyState = 4)
{
If (xhrObject. status = 200)
{
Document. getElementById (ElementID). src = url;
Alert (url );
}
}
}
XhrObject. open ("get", url );
XhrObject. send (null );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.