开发者

Printing Image using Imagecache in Views CustomField

开发者 https://www.devze.com 2023-02-08 18:49 出处:网络
I have content type as \"company_profile\" and image field name as \"field_cp_logo\" . Now, I am using Views CustomField option to print it using imagecache preset name as \"jobsearch_company\" . I am

I have content type as "company_profile" and image field name as "field_cp_logo" . Now, I am using Views CustomField option to print it using imagecache preset name as "jobsearch_company" . I am using following code for it, but it not showing anything to me. Any help is appreciated here.

<?php
$fid = db开发者_如何转开发_fetch_object(db_query("SELECT f.field_cp_logo_fid FROM {content_type_company_profile} f WHERE nid = %d", $n_nid));
$img_path = db_fetch_object(db_query("SELECT f.filepath FROM {files} f WHERE fid = %d", $fid->field_cp_logo_fid));
$img_path = file_create_path($img_path->filepath);
$image = theme('imagecache', 'jobsearch_company', $img_path);
print $image;
?>


You gotta change your code as below

<?php
$fid = db_fetch_object(db_query("SELECT f.field_imgz_fid
FROM content_field_imgz f WHERE nid = %d", $data->nid));

$img = 
db_fetch_object(db_query("SELECT filepath FROM `files` WHERE fid = %d", $fid->field_imgz_fid));


$image = theme('imagecache', 'node_actual', $img->filepath);
print $image;
?> 
0

精彩评论

暂无评论...
验证码 换一张
取 消