How to merge transparent PNG with image using PHP?

You can merge the two images together using the PHP GD2 library. Example: <?php # If you don’t know the type of image you are using as your originals. $image = imagecreatefromstring(file_get_contents($your_original_image)); $frame = imagecreatefromstring(file_get_contents($your_frame_image)); # If you know your originals are of type PNG. $image = imagecreatefrompng($your_original_image); $frame = imagecreatefrompng($your_frame_image); imagecopymerge($image, $frame, 0, 0, … Read more

Can Android’s WebView automatically resize huge images?

Yes, it’s possible. You can try setting the WebView Layout using the code below. It resizes all Images (Greater than the Device Screen Width) to the Screen Width. This works for both Orientations (Portrait and Landscape) webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); You can add extra margins/padding later to get the spacing right.

jQuery Animation – Smooth Size Transition

Try this jQuery plugin: // Animates the dimensional changes resulting from altering element contents // Usage examples: // $(“#myElement”).showHtml(“new HTML contents”); // $(“div”).showHtml(“new HTML contents”, 400); // $(“.className”).showHtml(“new HTML contents”, 400, // function() {/* on completion */}); (function($) { $.fn.showHtml = function(html, speed, callback) { return this.each(function() { // The element to be modified var … Read more

Autoresize textbox control vertically

The current selected answer does NOT handle lines with no spaces such as “jjjjjjjjjjjjjjjjjjjj”x1000 (think about what would happen if someone pasted a URL) This code solves that problem: private void txtBody_TextChanged(object sender, EventArgs e) { // amount of padding to add const int padding = 3; // get number of lines (first line is … Read more

Automatically resize images with browser size using CSS

To make the images flexible, simply add max-width:100% and height:auto. Image max-width:100% and height:auto works in IE7, but not in IE8 (yes, another weird IE bug). To fix this, you need to add width:auto\9 for IE8. source: http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries for example : img { max-width: 100%; height: auto; width: auto\9; /* ie8 */ } and then … Read more

Scale image to fit a bounding box

Thanks to CSS3 there is a solution ! The solution is to put the image as background-image and then set the background-size to contain. HTML <div class=”bounding-box”> </div> CSS .bounding-box { background-image: url(…); background-repeat: no-repeat; background-size: contain; } Test it here: http://www.w3schools.com/cssref/playit.asp?filename=playcss_background-size&preval=contain Full compatibility with latest browsers: http://caniuse.com/background-img-opts To align the div in the center, … Read more

Android: How to Programmatically set the size of a Layout

Java This should work: // Gets linearlayout LinearLayout layout = findViewById(R.id.numberPadLayout); // Gets the layout params that will allow you to resize the layout LayoutParams params = layout.getLayoutParams(); // Changes the height and width to the specified *pixels* params.height = 100; params.width = 100; layout.setLayoutParams(params); If you want to convert dip to pixels, use this: … Read more