Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged image
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
use <?php>/images/someimage.gif
Such a path resolves to ..
http://www.yoursite.com/wp-content/themes/YOURTHEME/images/someimage.gif
0
756
posted 13 years ago by disgruntledillon
This goes in any phtml file to get the image from the skin folder
0
706
posted 13 years ago by uteman23
This is a much cleaner way to do this than the number of examples on the web. Every example I saw seemed to account for orientation - horizontal vs. vertical vs. square when looking at the input. This ignores horizontal and vertical by mapping the...
0
792
posted 13 years ago by dblack
Pull banner ad or image code from a given text file into an array and randomize the order. Banner/image codes in the file should be separated by tildes (~).
0
862
posted 13 years ago by bluecap
The following script will easily allow you to resize images using PHP.
3
864
posted 13 years ago by enkas
If post has featured image, use it.. If not, pick out the first in the post.. Still not working? Stick with the default one..
3
1061
posted 14 years ago by Wendelboe
Original custom fields code based on Wefunction's code here: http://wefunction.com/2008/10/tutorial-creating-custom-write-panels-in-wordpress/ enhanced to add support for uploading images.
1
842
posted 14 years ago by simnor
This code will retrieve the url of a featured image in order to use it as a background.
0
786
posted 14 years ago by jli
This code war written for a project I'm working on where a map of the world may need to be offset to center the view on specific areas. I'm also using it as a part of an iterative blur function to prevent seams from the blur operation.
I would lik...
0
871
posted 14 years ago by Jamie
If the optional parameter $crop is set to TRUE the image will be zoomed and cropped to specific size ($new_size). Else, the image will be resized to size, keeping aspect ratio and using $new_size as max size.
0
843
posted 14 years ago by stz184
I’ve been working on a CMS lately and having to create thumbnails for uploaded images is always a pain, lots of maths working out the correct sizes and such, so I’ve created a fairly small script to manipulate images in an object-oriented style.
0
736
posted 14 years ago by dom111
* Creates thumbnail from image
* thumbnail dimensions can be set as parameters
* accepts JPG, JPEG, GIF, PNG
* preserves transparency for GIF and PNG on thumbnails
* call function like this: createthumb(images/original.jpg, thumbs/thumb.j...
3
862
posted 14 years ago by alessio2
You can use this script in your projects when you need an image upload function. It checks file type, file size and error report. I also want you to check [giochi di spongebob](http://www.giochidispongebob.net) and [gratis mahjong](http://www.gratism...
1
913
posted 14 years ago by jackoder
Just set the variable `$email` to the user's email address. Hey presto! A Gravatar image!
You can also change the size by adjusting the `s=32` variable. Size is in pixels.
1
602
posted 14 years ago by JackWH