nghi Posted August 22, 2014 Share Posted August 22, 2014 the follow code works and downloads the image from the url. However, it doesn't generate the thumb nail in the back end. EG. $page = new page(); $page->template = 'basic'; $page->tittle = 'testing'; $page->save; $page->image = http://i.imgur.com/nFJzvUQ.jpg; $page->save; nFJzvUQ.200.00.jpg would not exist nFJzvUQ.jpg exist How do i genereate the thumbnail so it doesn't appear broken in the backend. Link to comment Share on other sites More sharing options...
adrian Posted August 22, 2014 Share Posted August 22, 2014 There are a few small things wrong with that code - missing parent, save not save() etc. This works for me: $p = new page(); $p->template = 'basic-page'; $p->parent = $pages->get(1); //set parent to homepage $p->title = 'testing7'; $p->save(); $p->images->add("http://i.imgur.com/nFJzvUQ.jpg"); $p->save(); Are you talking about the thumb that gets created when you have "Display Thumbnails in Page Editor" checked. The 200 in the filename is throwing me, since these are usually 100px high. I am getting the thumbnail created as soon as I load the page in the admin. What version of PW are you running? Link to comment Share on other sites More sharing options...
nghi Posted August 22, 2014 Author Share Posted August 22, 2014 Ah yay i kind of just wrote that example before I left home from work.I'm using 2.2. I guess i'll try to update to 2.4.There is an option on the image field checkbox to display thumbnailhttp://i.imgur.com/WNEcVpB.pngWhen i have it check off it links to a broken resized image. if i have it uncheck it seems to work. 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