Creating Image Border


<?php

/*

* This function is for creating image border . Here image1 is the full path of the

* image and border is the border size.

*

* This function returns the image which one is input with a definite image border

* defined by $border varible

*/

/*

* @author : ruzdi + (internet browsing help)

* @parameters : $image is full path of the image , $border is the border size

* @return : null

* @output : image1 will be replaced by the new image

*/

//THIS FUNCTION REPLACE OLD IMAGE BY THE NEW IMSGE AS THE NAME OF $image1 ON THE SAME FOLDER

function imageBorder($image1='image1.jpg',$border=10) {

$im = ImageCreateFromJpeg($image1);

$width = ImageSx($im);

$height = ImageSy($im);

$newimage_width = $width + ( 2*$border ); // this is the new width after adding border

$newimage_height = $height + ( 2*$border ); // this is the new height after adding border

$newimage = imagecreatetruecolor( $newimage_width, $newimage_height );

$border_color = imagecolorallocate( $newimage, 255, 255, 255 ); //here first paremeter is image name and next three are rgb value

imagefilledrectangle($newimage,0,0,$newimage_width,$newimage_height,$border_color);

imageCopyResized($newimage,$im,$border,$border,0,0,$width,$height,$width,$height);

ImageJpeg($newimage,$image1,100);

chmod($image1,0666);

}

/*

* This function is for creating image border . Here image1 is the full path of the

* image and border is the border size.

*

* This function returns the image which one is input with a definite image border

* defined by $border varible

*/

/*

* @author : ruzdi + (internet browsing help)

* @parameters : $image1 is full path of the image , $image2 new imagename, $border is the border size

* @return : null

* @output : A new $image2 will be created on the same folder

*/

//THIS FUNCTION PRODUCE NEW IMAGE AS THE NAME OF $image2 ON THE SAME FOLDER

function imageBorder2($image1='image1.jpg',$image2='image2.jpg',$border=0) {

$im = ImageCreateFromJpeg($image1);

$width = ImageSx($im);

$height = ImageSy($im);

$newimage_width = $width + ( 2*$border ); // this is the new width after adding border

$newimage_height = $height + ( 2*$border ); // this is the new height after adding border

$newimage = imagecreatetruecolor( $newimage_width, $newimage_height );

$border_color = imagecolorallocate( $newimage, 255, 255, 255 ); //here first paremeter is image name and next three are rgb value

imagefilledrectangle($newimage,0,0,$newimage_width,$newimage_height,$border_color);

imageCopyResized($newimage,$im,$border,$border,0,0,$width,$height,$width,$height);

ImageJpeg($newimage,$image2,100);

chmod($image2,0666);

}

imageBorder('replace.jpg',10);

imageBorder2('old.jpg','new.jpg',20);

?>;

click to download

Advertisements
  1. I’ve been surfing online more than 3 hours these days, but I never found any attention-grabbing article like yours. It’s beautiful worth
    enough for me. Personally, if all webmasters and bloggers made excellent
    content material as you probably did, the web shall be much more helpful than ever before.

  2. I ponder exactly why you titled this blog, “Creating Image Border Ruzdi’s Webblog”. In either case I actually loved it!Thanks for your time-Keeley

  3. I am genuinely grateful to the owner of this site who has shared this great paragraph at here.

  4. I am extremely inspired along with your writing skills as neatly as with the structure on your blog.

    Is that this a paid subject or did you modify it your self?
    Anyway keep up the nice high quality writing, it is uncommon to
    see a great blog like this one today..

  5. Fascinating blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple adjustements would really make my blog shine.
    Please let me know where you got your design. Thanks a lot

  6. Nice post. I learn something totally new and challenging
    on blogs I stumbleupon everyday. It will always be useful to read through articles from other authors and
    practice something from their sites.

  7. Hey there exceptional website! Does running a blog similar to this take a massive amount work?
    I have no understanding of computer programming however I was hoping to start my
    own blog in the near future. Anyway, should you have any recommendations or techniques for new blog
    owners please share. I understand this is off subject nevertheless I just
    had to ask. Thanks a lot!

  8. I seldom write opinions, however, I read over several remarks here at Creating Image Border | Ruzdi’s Webblog but had a couple of thoughts for you if you do not mind. Could it possibly be just me or do some of these remarks look as if they are coming from brain dead individuals? And, if you’re
    writing on other different web-sites, I wish to stay in touch
    with you. Can you post a listing of all your social network pages such as your linkedin profile, Facebook page or twitter feed?

  9. Jurassic Park Builder Cheats
    What exactly is Jurassic Park Builder

    You have witnessed several publication, picture with regards to Jurassic Recreation area anywhere.
    Today there is a modify to generate a dinosaur wonderland inside the lately launched
    on the web zynga activity: Jurassic Park Builder.
    This can be a cost-free sport for you to
    enjoy in COMPUTER, Notebook computer, new iphone 4 and also ipad activity
    provides you with towards the sultry Isla Nublar, where by ask you to develop the greatest concept
    playground. Transforming dinosaurs, adding accessories along with stability towers to produce Jurassic
    Park your car the particular hottest place on World.
    This kind of activity possess a trillion gamers.

    What’s Jurassic Park Builder Cheats

    After you become a member of this particular activity, perhaps at some time
    you will get a problems together with your equilibrium, Brucks, meats, coins… think
    boring. This specific Cheats software allow you to get best just about all
    source ingame, help you feel at ease throughout experience inside Jurassic Park Builder sport.

    Jurassic Park Builder Cheats

  10. Excellent website. Plenty of useful information here.
    I am sending it to several friends ans also sharing in delicious.
    And of course, thank you on your sweat!

  11. They get to choose their look according to what they deem to make
    them beautiful and what makes them happy. Push Back Cuticles Cutting your cuticles may leave them looking good a day or
    two after your manicure, but they’ll get ragged after that.
    These products help us to pamper our digits with care and within
    no time brings results.

  12. Great blog design, loving it a whole lot.

  13. Louis Vuitton Outlet Quite a few illegal hacking community reproductions of vintage designs seem to
    be customized along with traded making a claim they can be real genuine ones.
    From a school point of view she is using inventive spelling a non conventional way for novice spellers and readers that many
    schools now encourage. Now the question is–how long should children be allowed to play said video games.

  14. Woah! I’m really loving the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s
    difficult to get that “perfect balance” between superb usability and visual appeal.
    I must say you have done a awesome job with this.
    Additionally, the blog loads very quick for me on Firefox.
    Exceptional Blog!

  15. Just wish to say your article is as astonishing. The clearness in your post is simply great and i can assume you are an expert on this subject.
    Fine with your permission let me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please carry on the rewarding work.

  16. If you wish for to take much from this article then you have to
    apply these techniques to your won blog.

  17. I really like it when people come together and share ideas.
    Great blog, stick with it!

  18. Don’t make a movement toward the nest with your body or arm.
    Zaagkii Project teams spent hours and hours in the deep northwoods learning about native species plants including learning about the different benefits of the plants such as medicinal from Native American teachings thanks
    to NMU Center for Native American Studies Zaagkii project interns Leora and Levi
    Tadgerson. Those numbers translate to honeybees having pollinated more than one of every three bites of food we eat.

  19. I am regular visitor, Һow are you еverybody?

    Тhis article posted аt this website іs really gοod.

  20. fantastic submit, very informative. I ponder why
    the other specialists of this sector don’t realize this.

    You must proceed your writing. I am confident, you’ve a huge readers’ base already!

  21. Hello, Neat post. There is a problem with your site in internet explorer, might test this?
    IE nonetheless is the market leader and a big component of folks will
    omit your great writing because of this problem.

  22. Wonderful blog! Do you have any suggestions for aspiring writers?
    I’m planning to start my own blog soon but I’m a little lost on everything.

    Would you advise starting with a free platform like WordPress or go for a
    paid option? There are so many options out there that I’m completely overwhelmed
    .. Any suggestions? Many thanks!

  23. Undertaking affordable search engine marketing helps
    your business in two ways. In addition, marketers in this field will generate
    revenues of more than $4 billion by 2014, according to the
    US Affiliate Marketing Forecast. This infiltration of
    bad internet marketing schemes has made too many people weary of trusting anything that is offered online.

  24. You can go as quickly as you want or as slowly as you need while using this method.
    Nail-biting can cause your fingertips to be red and sore and your cuticles to bleed.
    Perhaps you want to check out my breathing tips & exercises.

  25. You could certainly see your enthusiasm in the
    article you write. The arena hopes for more passionate writers like you who
    are not afraid to mention how they believe.
    All the time go after your heart.

  26. With havin so much content do you ever run into any problems of plagorism or copyright violation? My blog
    has a lot of unique content I’ve either created myself or
    outsourced but it appears a lot of it is popping it up
    all over the web without my agreement. Do you know any ways
    to help prevent content from being ripped off?
    I’d certainly appreciate it.

  27. It’s really a great and helpful piece of info. I am satisfied that you shared this helpful information with us.
    Please stay us up to date like this. Thank you for sharing.

  28. Appreciation to my father who stated to me about
    this weblog, this blog is genuinely amazing.

  29. If some one wishes to be updated with latest technologies therefore he must be go
    to see this site and be up to date every day.

  30. This is very interesting, You’re a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of your magnificent post.
    Also, I have shared your website in my social networks!

  31. Thanks for visiting Clash of Clans Daily dose. The article on the
    day is How to Raid for Resources. Every one of us come to
    a point in the game where we never seem to discover the right combination of troops to successfully raid elixir or gold to continue our upgrading.

    The most obvious, and easily overlooked solution to this issue is Goblins.
    These small raiders do massive damage to gold and elixir.
    Their speed allows them to dodge mortar attacks, usually are the most devastating.
    Pair a hundred or so of them with five or six wall-breakers
    to bust them into the enemy’s stronghold. Works like
    a lure castle clash hack.

  32. When I originally commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get four e-mails with
    the same comment. Is there any way you can remove me from that service?
    Cheers!

  33. Every weekend i used to visit this site, because i want enjoyment,
    since this this web page conations actually nice funny data too.

  34. Heya i’m for the primary time here. I came across this board and I to find It really useful & it helped me out a lot.

    I’m hoping to give one thing again and help others like you helped me.

  35. This information has duly been noted by insurance companies, as UK van insurance has come down in recent times.

    This will determine how well equipped the van will need
    to be. Another important thing before you choose a removal company is that you need to look into the pricing structure too for the distance you are moving.

  1. September 27th, 2014

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: