0

here i using external database to get image location by using ID - i have external file called process.php

here is example for database table

http://im33.gulfup.com/M9OCy.png

and here is php code that i using and working fine

$query=mysql_query("SELECT * FROM titoex WHERE id=$GetPicId") or die(mysql_error());
$result=mysql_fetch_array($query);

$PicLocation =$result['location'];

i need to make it with wordpress , if i upload image with wordpress attachment i can get it by id too i was trying to search in wordpress database but i can`t find table , i really need some help :(

user2846328
  • 3
  • 1
  • 4

1 Answers1

0

It's stored in the $wpdb->posts (usually wp_posts) table. But if you have the ID, the easiest option will be to use the wp_get_attachment_image_src function, which returns an array with the image url, width and height.

If you just need it as an img tag ready for output, you could use the wp_get_attachment_image function.

Hobo
  • 7,536
  • 5
  • 40
  • 50
  • i using external php file and all i need just image location – user2846328 Oct 20 '13 at 19:25
  • Do you mind loading WordPress code in your file? You could call `wp-load.php` as described in [this answer](http://stackoverflow.com/questions/5306612/using-wpdb-in-standalone-script/5331944#5331944) and call the function I mentioned. – Hobo Oct 21 '13 at 06:02