Frank Vèssia Posted November 8, 2011 Posted November 8, 2011 For adding description to an image from API i use this code but i think it's to tricky because i need to save again the page for adding it.... <?php ... $link->save(); if ($input->post->imageurl){ $link->images->add("..".$input->post->imageurl); $link->save(); if ($input->post->alt){ $link->images->first()->description = $input->post->alt; $link->save(); } } is there an easier way to do that?
Adam Kiss Posted November 8, 2011 Posted November 8, 2011 I'm not completely sure, but shouldn't this work? <?php $page->images->add(...); if ($input->post->alt) $page->images->last()->description = $input->post->alt; $page->save();
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now