2
Contributors
4
Replies
44
Views
3 Years
Discussion Span
Last Post by DjFumon
0

Hello, i have the image link in $jm_anime_imagen, but how to save this image in one folder of my site?

$jm_anime_imagen = cut_str($pagina, '<meta property="og:image" content="', '" />');
echo $jm_anime_imagen;

thanks.

0

i have this function for save the image, but i need save the image with the content of $jm_anime_titulo.

function cache_image($jm_anime_imagen){
    //replace with your cache directory
    $image_path = 'imagen/';
    //get the name of the file
    $exploded_image_url = explode("/",$jm_anime_imagen);
    $image_filename = end($exploded_image_url);
    $exploded_image_filename = explode(".",$image_filename);
    $extension = end($exploded_image_filename);
    //make sure its an image
    if($extension=="gif"||$extension=="jpg"||$extension=="png"){
    //get the remote image
    $image_to_fetch = file_get_contents($jm_anime_imagen);
    //save it
    $local_image_file = fopen($image_path.$image_filename, 'w+');
    chmod($image_path.$image_filename,0755);
    fwrite($local_image_file, $image_to_fetch);
    fclose($local_image_file);
    }
    }


    cache_image($jm_anime_imagen);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.