Skip to main content

Posts

Showing posts with the label image

PHP custom postcard

i am creating a new feature on my site that allow people to send postcard to friends. in this section they can choose the image they want to send (they already uplaoded the image to their profile -> my pictures section)

best way to determine if a URL is an image in PHP

Using PHP, given a URL, how can I determine whether it is an image? There is no context for the URL - it is just in the middle of a plain text file, or maybe just a string on its own. I don't want high overhead (e.g. reading the content of the URL) as this could be called for many URLs on a page. Given this restriction, it isn't essential that all images are identified, but I would like a fairly good guess. At the moment I am just looking at the file extension, but it feels like there should be a better way than this. Here is what I currently have: function isImage( $url ) { $pos = strrpos( $url, "."); if ($pos === false) return false; $ext = strtolower(trim(substr( $url, $pos))); $imgExts = array(".gif", ".jpg", ".jpeg", ".png", ".tiff", ".tif"); // this is far from complete but that's always going to be the case... if ( in_array($ext, $imgExts) )

Copy Image from Remote Server Over HTTP

I am looking for a simple way to import/copy images from remote server to a local folder using PHP. I have no FTP access to the server, but all remote images can be accessed via HTTP (i.e. http://www.mydomain.com/myimage.jpg ). Example use: A user wishes to add an image to his profile. The image already exists on the web and the user provides with a direct URL. I do not wish to hotlink the image but to import and serve from my domain. Source: Tips4all

Android take screen shot programatically

First off i am writing a root app so root permissions are no issue. I've searched and searched and found a lot of code that never worked for me here is what i've pieced together so far and sorta works. When i say sorta i mean it makes an image on my /sdcard/test.png however the file is 0 bytes and obviously can't be viewed. public class ScreenShot extends Activity{ View content; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.blank); content = findViewById(R.id.blankview); getScreen(); } private void getScreen(){ Bitmap bitmap = content.getDrawingCache(); File file = new File("/sdcard/test.png"); try { file.createNewFile(); FileOutputStream ostream = new FileOutputStream(file); bitmap.compress(CompressFormat.PNG, 100, ostream); ostream.close(); } catch (Exception e) { e.printStackTrace(); } } } Any h

Setting an image for a UIButton in code

How do you set the image for a UIButton in code? I have this: UIButton *btnTwo = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btnTwo.frame = CGRectMake(40, 140, 240, 30); [btnTwo setTitle:@"vc2:v1" forState:UIControlStateNormal]; [btnTwo addTarget:self action:@selector(goToOne) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btnTwo]; but don't see what will set the image for it. Any help appreciated, Thanks // :)

Add layout for ImageView

I have an ImageView <ImageView android:id="@+id/auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10sp" android:src="@drawable/auto" /> How can I add layout for this image in onCreate for Activity? For instance, I want add background for this image. Thanks.

getting the image width from the href tag instead from img tag

i am working on a project in which i require the width of a image from href when i click on the specific image the width if the image displays in a alert . the following is the href and image code i am using <li> <a href="<?php echo $pic;?>?id=<?php echo $id;?>&pic=<?php echo $picID;?>" data-title="" data-desc=" " data-rel="group2" data-bw="<?php echo $pic;?>" class="lightbox" id="plzx" > <img src="<?php echo $pic;?>" width="160" height="160" title="Click To View"/></a> </li> whenever i try to get the width of the image it takes the image width from the img tag not from the href . as the img tag width is already defined "160" . is there a way possible for getting the width of the image from the <a href i am using the following code which is nit working $(

User draw shapes on top of an image

I would want to allow user to draw semi-transparent basic shapes (rectangle, circle) with user defined text over an image. The basic idea is to have a map underneath and users could mark certain areas of from it. It has been a while since doing web development and I'm quite uncertain which approach would be the best. It should work even on older browsers. Any help would be appreciated!

User draw shapes on top of an image

I would want to allow user to draw semi-transparent basic shapes (rectangle, circle) with user defined text over an image. The basic idea is to have a map underneath and users could mark certain areas of from it. It has been a while since doing web development and I'm quite uncertain which approach would be the best. It should work even on older browsers. Any help would be appreciated!

Zoom very much and keep a high quality of the image without loading a large image on iPhone

Does anyone know about some framework or some tutorial to help me develop a feature into an iPhone app which will allow the user to zoom in very much on an image and display high-quality details of the image without loading the large image. Something like Google Maps. You can see an example here: http://www.zoomify.com/

i WANT to use sharekit to share images from my NSMutablearray [closed]

I am using sharekit to share images, and want to be able to share all the images upon users request not just one image I am using sharekit to share images, and want to be able to share all the images upon users request not just one image // this is the code I have for my share button UIImage *image = [UIImage imageNamed:@"Atoms"]; SHKItem *item = [SHKItem image:image title:@"Look at this picture!"]; // Make the ShareKit action sheet SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; // Display the action sheet [actionSheet showInView:self.view]; // this is my array I want it my sharekit will respond to all the items in the array NSMutableArray *images = [[NSMutableArray alloc] initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",nil];

Android - Layout with images

I've been working on this for few days but I couldn't get the layout I need. I would like to have a layout similar to the image below. Can anyone guide me with this ? What kind of layout and view should I use ? Thanks :)

Drawing/warping a rectangular image into a quadrilateral image

I need to draw a BufferedImage within a given quadrilateral. I want to do that: I would like the cat to be deformed to be drawn within the quadrilateral. Graphics objects have different methods to draw images, but only to stretch them along the X and Y axis (See Graphics.drawImage methods). What I am dreaming of is a method Graphics.drawImage() where I specify the coordinates of the 4 quadrilateral points. Is there an easy way to do that?

Set variable within another context

I have the following function "use strict"; function Player { this.width; this.height; this.framesA = 5; this.image = new Image(); this.image.onload = function () { width = this.width; height = this.height / framesA; } this.image.src = "Images/angel.png"; } How can I make this code to work? I want the width and height in the Player function be inalized with the width and the height of the image when the onload function is called. I need this to work with strict mode (A must). If this should be accomplished another way feel free to teach. EDIT: I updated the code to reflect a more realistic situation(I didn't know this will be so complicated) EDIT 2: Another update to the code. I didn't notice that I wrote var insted of this. Sorry. Thanks in advance

Change Image onClick Within DIV?

I have a jsFiddle setup to where you will be able to click on the image to the left and when you do it changes the image, but when you click on the DIV as an entirety (expand-one) it does not swap the image out. I want to be able to click on a DIV (as a whole) and swap out an image that is within the DIV without having only being able to click on just the image. You can view what I mean here: http://jsfiddle.net/5PDV5/1/ Thank you all! :)