last day (15 days later) » 

15:41
0
Q: How to integrate noimage picture in this code

BatmanHow can i integrate a image if there is no attached image? I'm using this code with success to integrate no-image picture if is no picture is attached to post. <?php if ( ! $img = get_field('img_actor', $post_object->ID ) ) $img = '/wp-content/uploads/noimage1.jpg'; ?> <img class="actor_img...

yes but i need to display it, can you help me s_ha_dum ?
please see the image how it display [s23.postimg.org/yer9yk88b/image.jpg](http://s23.postimg.org/yer9yk88b/image.jpg)
What is $widget["image_from"] equal to in your first code snippet?
image from a custom field, please see the full code Line 138 - 143"github.com/MaineLearning/MaineLearning/blob/master/wp-content/…;
That link is not working. Is it equal to "custom"?
sorry for that i put it in the question, please see the updated text.
15:41
Okay. Does this line of code work? Does it return the correct ID?
$post_custom_id = get_post_meta( $row->post_id, $widget['image_custom'], true );
hy charles
15:53
hy charles
are you there
Sort of. Stckexchange is being a dick.
Did s_ha_dum answer your question.
it is not worpling pleasee see this link
2 seconds
it shoud have a image there
i add the function in function.php
function alter_meta_wpse_106998($a, $object_id, $meta_key, $single) {
if ('img_actor' === $meta_key) {

$meta_type = 'post';

$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');

if ( !$meta_cache ) {
$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
$meta_cache = $meta_cache[$object_id];
}

if ( empty($meta_cache[$meta_key]) ) {
$meta_cache[$meta_key][] = site_url('/wp-content/uploads/noimage1.jpg');
}

if ( !$meta_key ) {
return $meta_cache;
}

if ( isset($meta_cache[$meta_key]) ) {
img_actor - is the custom field of the image
are you still in chat?
The page source shows this:
<img class="film" src="/scripts/timthumb.php?src=%2Fwp-content%2Fuploads%2Fnoimage1.jpg&h=251&w=175&zc=1" alt="Tim Herlihy" title="Tim Herlihy"/>

The src is not a valid url. The %2F is a "/".
So, tomthumb can't find the image.
16:02
2 second to look
ok
let me explayn
this link
in left i have the page of the person
the big image with no picture
work;, it apear linke that because i want to get validate the image
in php the image is like that
<img class="actor_img" src="/scripts/timthumb.php?src=<?php echo urlencode($img); ?>&h=70&w=50&zc=1" alt="<?php echo get_the_title($post_object->ID) ?>" title="<?php echo get_the_title($post_object->ID) ?>" /></a>
ok
Wait. IT looks like Timthumb is finding the image:
in right we have our code
yes but please see in right
here i use Gd Star Rathing that i mention
What does "in right" mean?
16:06
do you accesed the link?
please see the 2(person) in right
You eman the right side of that page?
yes
sorry : top 3 actori
That is the same link.
ok
at 5 - the image is atached to post
Ryan Rowe
at Ryan Rowe - the image is atached to post
i want to display the image without adding a image to the post...
do you have team view?
What is Team View?
16:12
ok please see now i delete the image... from Ryan Rowe
is a program wich i alow you to see my destkop
www.teamviewer.com/en/index.aspx
Okay, I see that. What are you trying to do to that listing with your code?
Do you want to place the no image image there?
yes
:)
Okay.
Let6 me look at the code again.
if no image is atached i want to display the image without adding in post( the image)
thank's for helping me
Try this:
} else if ( 'custom' == $widget['image_from'] ) {

$post_custom_id = get_post_meta($row->post_id, $widget['image_custom'], true);

if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_post_meta( $row->post_id, $widget['image_custom'], true );
else
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . urlencode( '/wp-content/uploads/noimage1.jpg' ) . '&amp;h=70&amp;w=55&amp;zc=1';
}
16:20
and please if you know how can i add the alt image to that code
One thing at a time.
ok it works but other images are gone :)
see the link
Let me look again.
TRy this:
    if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
        $row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . urlencode( '/wp-content/uploads/noimage1.jpg' ) . '&amp;h=70&amp;w=55&amp;zc=1';
    else
        $row->image = get_post_meta( $row->post_id, $widget['image_custom'], true );
That didn't work either.
no it display to other
if you want i let you try with my mouse on my destkop
i have dreamweaver
all the thing you want
    if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
        $row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . urlencode( get_post_meta( $post_custom_id, '_wp_attached_file', true ) ) . '&amp;h=70&amp;w=55&amp;zc=1';
    else
        $row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . urlencode( '/wp-content/uploads/noimage1.jpg' ) . '&amp;h=70&amp;w=55&amp;zc=1';
16:29
2 second
nop
is not working
the code i put
else if ( 'custom' == $widget['image_from'] ) {

$post_custom_id = get_post_meta($row->post_id, $widget['image_custom'], true);
if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . urlencode( get_post_meta( $post_custom_id, '_wp_attached_file', true ) ) . '&amp;h=70&amp;w=55&amp;zc=1';
else
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . urlencode( '/wp-content/uploads/noimage1.jpg' ) . '&amp;h=70&amp;w=55&amp;zc=1';
let me explayn better
Try this:
    if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
        $row->image = get_bloginfo('url') . urlencode( '/scripts/timthumb.php?src=' ) . get_bloginfo('url') . '/' . urlencode( get_post_meta( $post_custom_id, '_wp_attached_file', true ) ) . urlencode( '&h=70&w=55&zc=1' );
    else
        $row->image = get_bloginfo('url') . urlencode( '/scripts/timthumb.php?src=' ) . get_bloginfo('url') . urlencode( '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1' );
nope
this is the code that i add in page to display that
<?php
wp_gdsr_render_rating_results(array('template_id' => 48, 'rows' => 1, 'select' => 'persoane', 'min_votes' => 0, 'min_count' => 0, 'excerpt_words' => 0, 'image_from' => 'custom', 'image_custom' => 'img_actor', 'image_resize_x' => 55, 'image_resize_y' => 70, 'publish_days' => 1, 'rating_size' => '12', 'review_size' => '12', 'rating_thumb_size' => '12'));
?>
were image_custom' => 'img_actor'
is the custom field of the actors
img_actor - custom field
in the theme of GDStar rathing i have

$post_custom_id = get_post_meta($row->post_id, $widget["image_custom"], true);
$row->image = get_bloginfo('url')."/scripts/timthumb.php?src=".get_bloginfo('url')."/wp-content/uploads/"
.get_post_meta($post_custom_id,"_wp_attached_file",true)."&amp;h=70&amp;w=55&amp;zc=1";
how can i get noimage
please install that program you will work on my computer to see the code exacly ..if you want
www.teamviewer.com/en/index.aspx
16:40
ok
Doublecheck this line of code:
$row->image = get_bloginfo('url') . urlencode( '/scripts/timthumb.php?src=' ) . get_bloginfo('url') . urlencode( '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1' );
In the page source, the noimage part is missing.
2 seconds
i have this in code
if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_bloginfo('url') .urlencode( '/scripts/timthumb.php?src=' ) .get_bloginfo('url') . '/' .urlencode( get_post_meta( $post_custom_id, '_wp_attached_file', true ) ) .urlencode( '&h=70&w=55&zc=1' );
else
$row->image = get_bloginfo('url') .urlencode( '/scripts/timthumb.php?src=' ) .get_bloginfo('url') . '/'.urlencode( '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1' );
not working
Okay. Try this:
if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_bloginfo('url') .urlencode( '/scripts/timthumb.php?src=' ) . get_bloginfo('url') . '/' . get_post_meta( $post_custom_id, '_wp_attached_file', true ) . '&amp;h=70&amp;w=55&amp;zc=1';
else
$row->image = get_bloginfo('url') .urlencode( '/scripts/timthumb.php?src=' ) . get_bloginfo('url') . '/'. '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1';
nop :9
:(
im tring to do that for a long time but no sucess
One more time?

if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . '/' . get_post_meta( $post_custom_id, '_wp_attached_file', true ) . '&amp;h=70&amp;w=55&amp;zc=1';
else
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . '/'. '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1';
16:55
it display to all the image
Do you still have this line?
   $post_custom_id = get_post_meta( $row->post_id, $widget['image_custom'], true );
Above the "if"
else if ($widget["image_from"] == "custom") {
} else if ( 'custom' == $widget['image_from'] ) {

$post_custom_id = get_post_meta( $row->post_id, $widget['image_custom'], true );
OR :
else if ($widget["image_from"] == "custom") {
ok let me try
all the code i have now
else if ($widget["image_from"] == "custom") {

$post_custom_id = get_post_meta( $row->post_id, $widget['image_custom'], true );

if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . '/' . get_post_meta( $post_custom_id, '_wp_attached_file', true ) . '&amp;h=70&amp;w=55&amp;zc=1';
else
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . '/'. '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1';
Try this:
if ( get_post_meta( $post_custom_id, '_wp_attached_file', true ) )
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . '/wp-content/uploads/' . get_post_meta( $post_custom_id, '_wp_attached_file', true ) . '&amp;h=70&amp;w=55&amp;zc=1';
else
$row->image = get_bloginfo('url') . '/scripts/timthumb.php?src=' . get_bloginfo('url') . '/wp-content/uploads/noimage1.jpg&amp;h=70&amp;w=55&amp;zc=1';
17:03
:)
it works
yeeee
other thing i want if you ar kind how to set up the alt image
What is an "alt image"?
every image have an alt=""
atribute
to validate the image
i want the alt of the image to be the title
Line 461, Column 189: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

…o/wp-content/uploads/clifton-collins-jr.jpg&amp;h=70&amp;w=55&amp;zc=1"/></div>
I know what the alt attribute is. You will have to change lines 524 through 534 to add that. That seems to be where the <img> tag is created.
Wait. It is also in lines 256 and 288. Is this your code or is it a pluigin?
is a plugin
gd star rathing plugin... is for free
is for rathing
can i use .urlencode( into my actual code
wath you work
The changes you make will be removed if the plugin is updated. You might want to change the code to stop updates.
17:13
i know.. but i change every time when i make an update
You should probably ask another question for adding the alt attribute.
Have you asked the plugin author about it?
i ask .. but nobody answer
let me search the question
What is the link to the question?
0
Q: Markup Validation Service problem with alt images

BatmanHy,i have try over a week to validate 4 images that are retrived by a code with GD Star Rating plugin This is the code i have: <?php wp_gdsr_render_rating_results(array('template_id' => 49, 'rows' => 4, 'select' => 'post', 'hide_empty' => false, 'min_votes' => 0, 'min_count' => 0, 'excerpt_wor...

:)
annyway thank for that
I have a doctor's appointment in an hour. I'll look at it later today.

I posted the solution above as an answer to this question.
17:19
ok
i gave it ok
thanks for all
i will try to resolve other problem the validation
see you soon
ok
thank's again... bye

last day (15 days later) »