/    Sign up×
Community /Pin to ProfileBookmark

Is there a way to crop an image

Hi all,

I have a page on my site that requires an images to have a dynamic width.
If you look on the page in question [URL=”http://www.postedoverseas.com/top30.php”]http://www.postedoverseas.com/top30.php[/URL]
you will see that the score for each company. This is made up of 2 images.
Image 1: 5 blank stars
Image 2: a solid orange background behind the stars

At the moment the I have a php script on the page itself with the lines

[code=php] echo ‘<style media=”screen” type=”text/css”>
.starsFull’ . $div . ‘ {
position:absolute;
width:’ . $row_top30[‘score’] . ‘px;
height:20px;
background-image:url(‘images/starsFull.gif’);’;
[/code]

This works fine in its current configuration, however. As the CSS is on the page itself the page will not validate as XHTML. I am also looking at turning the solid colour to a varying one (say red to green). This means that making the <img width=””> tag dynamic is out of the question as it would simply squeeze the image and not crop it.

Does anyone know of a way that I could either get the CSS accepted by the XHTML validator or get php to crop the image instead of resizing it so that I could create the width tag dynamically.

I hope this all makes sense

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@bokehFeb 02.2007 — I've got an answer for this but at the minute I don't have time to write the solution.
×

Success!

Help @postedoverseas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...