Jump to content

Resize image inside html content


sowna

Recommended Posts

Hi, i want to resize the image inside html content. If the image width above 600, i have to set to 600 as default width for that image.

 

Example,

$string = '<p>Also from the wonderful Tank Theory line is this nice Comrade t-shirt. She’s not all that innocent, not that she really looks it, but if you inspect the shirt closer you’ll see she is hiding something on the back. The shirt is now available in red with black wterbased print, and gold foil accents.</p>
<p><a title="Tank Theory Comrade" href="http://www.tanktheory.com/store/standard-t-shirts/product/comrade/" target="_blank"><img class="alignnone size-full wp-image-2642" title="m_509_tank_theory_red" src="http://www.birdfight.com/blogfiles/wp-content/uploads/2009/02/m_509_tank_theory_red.jpg" alt="m_509_tank_theory_red" style="height: 400px; width:800px;"></a></p>';

 

Please help me...

Link to comment
Share on other sites

No...if you apply like that then it will set width 600 to all images...

 

I don't want like that...

 

I want to resize those image width more than 600.

what joe92 provided will do exactly what you are saying that you will want, any image that is less then a width of 600px will not be affected by the CSS, and image bigger than 600px will be shrunk to a width of 600px.

Link to comment
Share on other sites

while loading itself i have to resize the image.

 

can you please tell me how to get the width, height of the image and to replace the custom width and height.

 

From:

<img src="test.jpg" style="width:1024px; height:600px;" title="test" alt="test">

 

To:

<img src="test.jpg" style="width:600px; height:400px;" title="test" alt="test">

 

plz....

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.