Php 显示特定大小的图像

Php 显示特定大小的图像,php,html,Php,Html,我在php中显示特定大小的图像时遇到了一个问题。在这里,我使用了foreach循环。谁能帮我解决这个问题 这是密码 <?php function scrape_insta_hash($tag) { $insta_source = file_get_contents('https://www.instagram.com/explore/tags/'.$tag.'/'); // instagrame tag url $shards = explode('window._

我在php中显示特定大小的图像时遇到了一个问题。在这里,我使用了foreach循环。谁能帮我解决这个问题

这是密码

    <?php
function scrape_insta_hash($tag) {
    $insta_source = file_get_contents('https://www.instagram.com/explore/tags/'.$tag.'/'); // instagrame tag url
    $shards = explode('window._sharedData = ', $insta_source);
    $insta_json = explode(';</script>', $shards[1]); 
    $insta_array = json_decode($insta_json[0], TRUE);
    return $insta_array; // this return a lot things print it and see what else you need
}

    $tag = 'paris'; // tag for which ou want images 
    $results_array = scrape_insta_hash($tag);
    //$limit = 7; 
    $limit = 15; // provide the limit thats important because one page only give some images.
    $image_array= array(); // array to store images.
    for ($i=0; $i < $limit; $i++) { 

        $latest_array = $results_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'][$i]['node'];
        $image_data  = '<img src="'.$latest_array['thumbnail_src'].'">'; // thumbnail and same sizes 
        //$image_data  = '<img src="'.$latest_array['display_src'].'">'; actual image and different sizes 
        array_push($image_array, $image_data);
    }


    foreach ($image_array as $image) {
        echo $image;

        }

?>

使用所需的图像高度宽度属性更改for循环

for ($i=0; $i < $limit; $i++) { 

        $latest_array = $results_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'][$i]['node'];
        $image_data  = '<img height="150" width="150" src="'.$latest_array['thumbnail_src'].'">'; // thumbnail and same sizes 
        //$image_data  = '<img src="'.$latest_array['display_src'].'">'; actual image and different sizes 
        array_push($image_array, $image_data);
    }
for($i=0;$i<$limit;$i++){
$latest_array=$results_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'][$i]['node'];
$image\u data='';//缩略图和相同大小
//$image_data='';实际图像和不同大小
数组推送($image\u数组,$image\u数据);
}

在$image\u数组中是什么?$image包含什么?如果是HTML代码,请编辑HTML代码(或CSS)。您能解释更多吗?如果可能,请尝试添加代码和屏幕截图,对代码进行更多解释,以便更容易理解所需的输出。从这里开始,它仅显示图像。但我需要进入特定的大小。我重新编辑代码。它正在工作。谢谢。太好了,编码快乐@Octavia,另一个问题的答案已被主持人删除。请接受这个答案。