I need a help. I need to get the main url of an image uploaded in wprdpress from the url of the re sized one's url. If possible the link of the attachment. Experts please help. Thanks in advanced.

Example-

re sized url-

```
1. http://www.example.com/wp-content/uploads/2013/05/image-1-90x120.jpg
2. http://www.example.com/wp-content/uploads/sites/9/2013/01/image-1-1040x320.png
3. http://www.example.com/wp-content/uploads/custom_upload_folder/image-1-430x210.jpg

```

what i'm looking for-

```
1. http://www.example.com/wp-content/uploads/2013/05/image-1.jpg or http://www.example.com/?attactment_id=12
2. http://www.example.com/wp-content/uploads/sites/9/2013/01/image-1.png or http://www.example.com/?attactment_id=12
3. http://www.example.com/wp-content/uploads/custom_upload_folder/image-1.jpg or ttp://www.example.com/?attactment_id=12

```

I can't use regex as i'm novice at this. again i can't use `substr` as image sizes of the resized ones are different.
attactment\_id is the attachment id if the image is uploaded through the wordpress media uploader.

Thanks a lot.