douxian1770 2015-12-06 22:18
浏览 26

强制图像宽度和高度PHP

I have a CMS website that displays user's images. The site currently uses an array to display the max. image width, however this is breaking my design a little and I'd like to force the images to a set width and height.

In one of the files the image is referenced using the following code:

$rs_model_shout[$c]['vImageUrl'] = getImageURL($rs_model_shout[$c]['vImage'], getModelImagePath($rs_model_shout[$c]['iModelId'])."/", getModelImageURL($rs_model_shout[$c]['iModelId'])."/", $imgNamePrefix='2_', $imgDefaultURL=$site_url.'images/default.jpg');

How can I edit this to specify width and height? I tried just adding width="80" height="100", but this made no changes.

Thanks!!

I tried to view the output, but still receive a blank page. Maybe I am entering the var_dump incorrectly?

<?php
ob_start();
var_dump($rs_model_shout[$c]['vImage']);
error_reporting(E_ALL); ini_set("display_errors", "On");
$result = ob_get_clean();
?> 
  • 写回答

1条回答 默认 最新

  • doudao5287 2015-12-07 02:13
    关注

    I was able to make this work, however the answer was not in the php line of code I originally thought..

    On a different file there was a reference to the img src which I was able to edit with the following:

    <img src="'.$rs_model_shout[$v]['vImage_url'].'" alt="'.$rs_model_shout[$v]['vShoutTitle'].'" style="width:150px;" height="200px;" />
    
    评论

报告相同问题?

悬赏问题

  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法