Frank Vèssia Posted November 8, 2011 Share 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? Link to comment Share on other sites More sharing options...
Adam Kiss Posted November 8, 2011 Share 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(); Link to comment Share on other sites More sharing options...
Frank Vèssia Posted November 8, 2011 Author Share Posted November 8, 2011 It works, thanks Link to comment Share on other sites More sharing options...
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