Detailed Image

sorry it doesn’t work,but I know solution now.It’s simple than I think.



Tested and work.






Thanks you so much,if don’t have your post maybe I can’t know it.

[quote name=‘unique2’]Ok, I have the solution! I know probably no one cares right now, but having the ability to pull your main image location without lots of queries and hardcoding the path is actually very useful. :slight_smile:



To harvest the image path I wrote a function called fn_get_full_image_url($image_id, $object_id)



function fn_get_full_image_url($image_id, $object_type)
{
$image_data = fn_get_image($image_id, $object_type);

return !empty($image_data) ? 'http://' . Registry::get('config.http_host') . $image_data['http_image_path'] : '';
}




This function uses the image_id then calls up fn_get_image to get the image_data array which has the field http_image_path which is the path to the image on your site. I put this code in the /core/fn.images.php file, as it makes sense to me for it to be in there.



Then utilizing that function elsewhere in your site you would do:



$image_p_data = fn_get_image_pairs($product_id , 'product', 'M'); //get the image_data array
$image_full_path = fn_get_full_image_url($image_p_data['image_id'], 'product');




Now the $image_p_data variable is an array with several fields:

pair_id

image_id

detailed_id

icon → which is actually an array (with image_icon info)

detailed → which is also an array (image_detailed info like path, alt value, height, width, etc.)



For this exercise we just want the image_id field, so we put $image_p_data[‘image_id’] into the fn_get_full_image_url() and boom, you got your all your image info!



Hope this helps someone along the way who doesn’t enjoy repeatedly banging their head on their desk until the answer finally comes out. :cool:[/QUOTE]





Please can you explain a little bit more, and maybe an example from a .tpl file cause i don’t understand how to call it up now…



Thank you!

[quote name=‘unique2’ timestamp=‘1263452302’ post=‘66914’] Ok, I have the solution! I know probably no one cares right now, but having the ability to pull your main image location without lots of queries and hardcoding the path is actually very useful. :-) To harvest the image path I wrote a function called fn_get_full_image_url($image_id, $object_id) php function fn_get_full_image_url($image_id, $object_type) { $image_data = fn_get_image($image_id, $object_type); return !empty($image_data) ? 'http://' . Registry::get('config.http_host') . $image_data['http_image_path'] : ''; } This function uses the image_id then calls up fn_get_image to get the image_data array which has the field http_image_path which is the path to the image on your site. I put this code in the /core/fn.images.php file, as it makes sense to me for it to be in there. Then utilizing that function elsewhere in your site you would do: ```php
$image_p_data = fn_get_image_pairs($product_id , ‘product’, ‘M’); //get the image_data array $image_full_path = fn_get_full_image_url($image_p_data[‘image_id’], ‘product’);

<br />
<br />
Thank you so much for sharing this.  It helped me a lot. Thanks a lot!<br />
<br />
Dan<br />
<br />
<br />
for those that want an external page to display the path of an image based on the id of the product use this code in a custom  file your main folder:  (It could be handy for custom CMS development)<br />
<br />
```php
<br />
<?php<br />
define('AREA', 'C');<br />
define('AREA_NAME', 'customer');<br />
require dirname(__FILE__) . '/prepare.php';<br />
require dirname(__FILE__) . '/init.php';<br />
$image_p_data = fn_get_image_pairs($_GET["id"] , 'product', 'M');<br />
echo $image_p_data["detailed"]["image_path"];<br />
//where $_GET["id"]  would be thisfile.php?id=(productid)<br />
?><br />