Tweak inline image styling to divide max-width by half

A

Anonymous

Guest
Hello.

I'm not a PHP coder (more frontend dev) but I've been tasked with tweaking some PHP.

Specifically, the client wants to upload double-sized images but still get the image to display at the original size.

At the moment, when an image is uploaded (via a custom image manager) the width of the image is noted and an inline style is generated within a file called ajax_actions.php:

Code:
$obj = new Image($id);

<img src="'.$obj->src().'" title="'.$obj->artist().'" style="max-width:'.$obj->width().'px;"/>

The bit I'm interested in is this:

Code:
style="max-width:'.$obj->width().'px;"

Is there any way of introducing a calculation to halve the size of the uploaded image into the empty brackets following width, e.g.

Code:
$obj->width(/2)
?

Any help would be much appreciated :D
 
Not in the brackets, but just after:

Code:
$obj->width() / 2
 
Back
Top