Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Save image from $Image to file



Permlink Replies: 3 - Last Post: Nov 13, 2015 4:58 AM Last Post By: Goffredo Vincenzo Threads: [ Previous | Next ]
Goffredo Vincenzo

Posts: 68
Registered: 10/1/02
Save image from $Image to file
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 3, 2015 11:43 AM
Hi,

I have insert in a page the image component and when I load the page

function Page1BeforeShow($sender, $params)
    {
        $this->Image1->ImageSource = "https://scontent.xx.fbcdn.net/hprofile-xta1/v/t1.0-1/p50x50/11403359_102046346456963240_7104065345355778214249_n.jpg?oh=75e3264364356456b7306260a0d0ab959ad4c&oe=578C2A8E6";
    }
 


How to save the photo present in this component in a file example "./zzz.jpg" ?

Edited by: Goffredo Vincenzo on Nov 3, 2015 12:17 PM
Goffredo Vincenzo

Posts: 68
Registered: 10/1/02
Re: Save image from $Image to file
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 12, 2015 3:40 PM   in response to: Goffredo Vincenzo in response to: Goffredo Vincenzo
No possible solution?
Erick Engelke

Posts: 101
Registered: 12/5/02
Re: Save image from $Image to file
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 12, 2015 7:22 PM   in response to: Goffredo Vincenzo in response to: Goffredo Vincenzo
Goffredo Vincenzo wrote:
Hi,

I have insert in a page the image component and when I load the page

function Page1BeforeShow($sender, $params)
    {
        $this->Image1->ImageSource = "https://scontent.xx.fbcdn.net/hprofile-xta1/v/t1.0-1/p50x50/11403359_102046346456963240_7104065345355778214249_n.jpg?oh=75e3264364356456b7306260a0d0ab959ad4c&oe=578C2A8E6";
    }
 


How to save the photo present in this component in a file example "./zzz.jpg" ?

Edited by: Goffredo Vincenzo on Nov 3, 2015 12:17 PM

I'm quite sure what you want to do, so I'll take a guess.

You have some remote URL : $source = 'https://scontent.....'
You want to download that image to your server. Well, there may be copyright issues, but I'll assume for now that you have looked after those copyright issues.

$source = 'https://scontent.....'
$f = file_get_contents( $source );
if ( $f !== FALSE )
file_put_contents( '/var/temp/image.jpg', $f );

Look up the file_get_contents() and file_put_contents() functions, they are obviously the workhorses in the code segment.

--
Erick Engelke
HTML5 Builder Book
http://www.erickengelke.com

Goffredo Vincenzo

Posts: 68
Registered: 10/1/02
Re: Save image from $Image to file
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2015 4:58 AM   in response to: Erick Engelke in response to: Erick Engelke
Thank you
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02