Sign up to create your own snipts, or login.

Public snipts » img The latest public img snipts.

showing 1-9 of 9 snipts for img
  • image link
    <? 
    $img_path = "/images/arr_leggi_blu.gif"; 
    $link_path = "node/47";
    $theme_name = 'pmsth';
    
    $img = theme('image',  drupal_get_path('theme', 'pmsth'). $img_path); 
    print l($img, $link_path, array('html' => true));
    
    ?>
    

    copy | embed

    0 comments - tagged in  posted by allaterza on Feb 06, 2010 at 6:24 a.m. EST
  • image
    <? 
    $path = "/images/arr_leggi_blu.gif"; 
    $theme_name = 'pmsth';
    
    print theme('image',  drupal_get_path('theme', $theme_name). $path);
    ?>
    

    copy | embed

    0 comments - tagged in  posted by allaterza on Feb 06, 2010 at 6:13 a.m. EST
  • Parsare immagini da una pagina html
    <?php
      $variabile = "Testo di prova <img src=\"test1.jpg\" alt=\"foto test1\" /><img src=\"test2.jpg\" alt=\"foto test 2\" />";
     
      $documentodom = new DOMDocument;
      $documentodom->loadHTML($variabile);
     
      $xPath = new DOMXPath($documentodom);
     
      $query_path = $xPath->query('//img[@src]');
        foreach ($query_path as $query_path){
        $srcimag = $query_path->getAttribute('src');
        echo "<img src=\"".$srcimag."\" alt=\"Immagini Estratte\" />";
      }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by azote on Dec 03, 2009 at 5:47 a.m. EST
  • PNG transparent 1x1px generator
    <?php
    /*****************************************************************
     * Script for automatic generation of one pixel
     * alpha-transparent images for non-RGBA browsers.
     * @author Lea Verou
     * @version 1.0 beta
     * Licensed under a MIT license
     *****************************************************************/
    
    ######## SETTINGS ##############################################################
    
    /**
     * Enter the directory in which to store cached color images.
     * This should be relative and SHOULD contain a trailing slash.
     * The directory you specify should exist and be writeable (CHMOD 666 or 777).
     * If you want to store the pngs at the same directory, leave blank ('').
     */
    define('COLORDIR', 'rgba/');
    
    
    /**
     * If you requently use a color with varying alphas, you can name it
     * below, to save you some typing and make your CSS easier to read.
     */
    $color_names = array(
    	'white' => array(255,255,255),
    	'black' => array(0,0,0)
    	// , 'mycolor' => array(red value, green value, blue value)
    );
    
    
    /**
     * If you don't want the generated pngs to be stored in the server, set the following to
     * false. This is STRONGLY NOT RECOMMENDED. It's here only for testing/debugging purposes.
     */
    define('CACHEPNGS', true);
    
    
    
    ######## NO FURTHER EDITING, UNLESS YOU REALLY KNOW WHAT YOU'RE DOING ##########
    
    $dir = substr(COLORDIR,0,strlen(COLORDIR)-1);
    if(!is_writable($dir))
    {
    	die("The directory '$dir' either doesn't exist or isn't writable.");
    }
    
    $rgb = $color_names[$_GET['name']];
    
    $red	= is_array($rgb)? $rgb[0] : intval($_GET['r']);
    $green	= is_array($rgb)? $rgb[1] : intval($_GET['g']);
    $blue	= is_array($rgb)? $rgb[2] : intval($_GET['b']);
    $alphaurl = $_GET['a'];
    
    // "A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent."
    // http://www.php.net/manual/en/function.imagecolorallocatealpha.php
    $alpha = intval(127 - 127 * ($alphaurl / 100));
    
    // Does it already exist?
    $filepath = COLORDIR . "r{$red}_g{$green}_b{$blue}_a{$alphaurl}.png";
    
    if(/*CACHEPNGS and */file_exists($filepath))
    {
    $url = "http://{$_SERVER['HTTP_HOST']}/{$filepath}";
    header("Status: 301");
    die(header("Location: {$url}"));
    }
    else
    {
    	// Send headers
    header('Content-Type: image/png');
    header("Expires: ".gmdate("D, d M Y H:i:s", strtotime('+5 years'))." GMT"); 
    
    
    	$img = @imagecreatetruecolor(1,1) or die('Cannot Initialize new GD image stream');
    	
    	// This is to allow the final image to have actual transparency
    	// http://www.php.net/manual/en/function.imagesavealpha.php
    	imagealphablending($img, false);
    	imagesavealpha($img, true);
    	
    	// Allocate our requested color
    	$color = imagecolorallocatealpha($img, $red, $green, $blue, $alpha);
    	
    	// Fill the image with it
    	imagefill($img,0,0,$color);
    
        // Save the file
    	imagepng($img,$filepath,0,NULL);
    	
    	// Serve the file
    	imagepng($img);
    	flush();
    	
    	// Free up memory
    	imagedestroy($img);
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by aidilfbk on May 25, 2009 at 7:49 a.m. EDT
  • IE7 Optimization of zoom picture
    img {-ms-interpolation-mode: bicubic}
    

    copy | embed

    0 comments - tagged in  posted by siggiarni on May 04, 2009 at 9:07 a.m. EDT
  • Convert a DMG file to an IMG file then mount it
    dmg2img -i <FILE.DMG> -o <FILE.IMG>
    mount -t hfsplus -o loop <FILE.IMG> <MOUNTPOINT>
    

    copy | embed

    0 comments - tagged in  posted by d1s4st3r on Apr 25, 2009 at 10:50 a.m. EDT
  • IE7 Optimization of zoom picture
    img {-ms-interpolation-mode: bicubic}
    

    copy | embed

    0 comments - tagged in  posted by idanke on Apr 21, 2009 at 9:13 p.m. EDT
  • Proportional image resize
    img {width:85%;height:auto}
    

    copy | embed

    0 comments - tagged in  posted by nell on Mar 06, 2009 at 11:13 p.m. EST
  • pad images nicely on website css
    img {
            padding: 10px;
            margin: 5px;
    }
    

    copy | embed

    0 comments - tagged in  posted by titanium_geek on Dec 18, 2008 at 11:37 p.m. EST
Sign up to create your own snipts, or login.