Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 09-30-2009, 12:13 PM Remove image by size
Junior Talker

Posts: 3
Name: Kaido
Trades: 0
So i need to remove images smaller than 10x10px from cache any ideas someone?
So i tried like this

PHP Code:
$body"<img width='1' />";
echo 
$body preg_replace("/<img[^>]+>/i","",$body); 
but it removes all images

Last edited by kristallaju; 09-30-2009 at 01:22 PM..
kristallaju is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-30-2009, 07:11 PM Re: Remove image by size
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
There's nothing in your regular expression which says < 10x10 in size. I'd suggest searching through the string for img tags, finding the width of the tag (if provided, some are left at default, so you'd have to retrieve those and then determine their size), and remove if necessary.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Remove image by size
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09996 seconds with 12 queries