-2

I have this problem.

There is a Joomla site that has a image presented via PHP file image.php that has some Content-Type to be projected as Image.

I want to get that image with cURL or file_get_contents and save it as .jpg file.

The URL Looks like: http://radioglos.pl/components/com_eventgallery/helpers/image.php?option=com_eventgallery&mode=full&view=resizeimage&folder=2020-12-12kielpino&file=_ZBG5132.jpg

It has image.php script that is projecting the passed image via GET parameter as Content-Type Image.

I've already tried standard file_get_contents() method aswell as all cURL methods described in this topic: Saving image from PHP URL

Looking for answers.

  • 3
    Welcome. What is your question? Does something not work? Where's _your_ code? The link you posted has two ways of doing it, don't they work too? – brombeer Dec 14 '20 at 10:28
  • Requesting the image data from the given URL works absolutely fine for me with `file_get_contents`. – CBroe Dec 14 '20 at 11:38
  • Hey. Thank you @CBroe. Probably becouse I am using php 5.4.45. Gonna investigate that. Thanks for leading me to this place. – el lukasion Dec 14 '20 at 12:26
  • Why are you still using such a _massively_ outdated PHP version? That has not gotten even any security fixes for ages. – CBroe Dec 14 '20 at 12:27
  • Thats our client choice. Fact is that it wasnt becouse of PHP Version. It was the hidden & in the link. Here's the solution: str_replace('&', '&', $imgReplaced); – el lukasion Dec 14 '20 at 13:14

2 Answers2

0

try to use file_put_contents() function

//Get the file
$content = file_get_contents("http://www.google.co.in/intl/en_com/images/srpr/logo1w.png");
//Store in the filesystem.
$fp = fopen("/location/to/save/image.png", "w");
fwrite($fp, $content);
fclose($fp);

from PHP - Copy image to my server direct from URL

Mariano
  • 473
  • 3
  • 12
  • Hey. I described in the topic that I've already tried this method. The url is like: http://radioglos.pl/components/com_eventgallery/helpers/image.php?option=com_eventgallery&mode=full&view=resizeimage&folder=2020-12-12kielpino&file=_ZBG5132.jpg. Pay attention to the "image.php" detail. Its not working towards this url. – el lukasion Dec 14 '20 at 10:47
  • Still looking for answers. Edited topic description to be more specific. – el lukasion Dec 14 '20 at 10:50
0

Solution:

$imgReplaced = str_replace('&', '&', $imgReplaced);
  • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - [From Review](/review/low-quality-posts/27842591) – Devator Dec 14 '20 at 18:33
  • 1
    @Devator The OP has posted a solution to the question. Solutions should not be added to the question. – Trenton McKinney Dec 14 '20 at 21:30