peer_reviewed_article: Add featured image #290
No reviewers
Labels
No labels
Component: User interface
Component: Wymeditor
Help wanted
Level: Difficult
Level: Easy
Level: Moderate
Pagetype: Festival
Pagetype: Mailinglist
Pagetype: Peer reviewed article
Pagetype: Text
Privacy GDPR AVG
status: has conflicts
Status: Needs changes
Status: Needs discussion
Status: Needs review
Status: Ready to merge
Status: Waiting for response
Type: Bug
Type: Enhancement
Type: Question
Usecase: De Stadsbron
Usecase: Koppelting
Usecase: MeetjeStad
Value: Coders
Value: Security
Value: Users
Value: Visitors
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
harmen/hypha!290
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "article-excerpt-focus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
peer_reviewed_article: more focus on excerpt
peer_reviewed_article: added feature image
I left some comments inline.
Overall, I wonder about the duplication in code between the article edit form handling and the wymeditor upload handling. Can we somehow unify these two?
I can imagine that the editor does a background upload (like the wymeditor) and then puts the resulting url/filename in the edit form, rather than uploading the image as part of the edit form itself.
Alternatively, I can imagine that the code is slightly generalized and can be called from both the wymeditor upload handler as well as from the article edit form handler? Or maybe the HTMLForm class could support this somehow?
This log should probably be removed.
This probably needs some htmlencoding for the src attribute (probably easiest to generate an img with src and then use the jquery attribute set method to set the src).
What's the point of the
acceptattribute here? I could not find any info on it?Also, this link and/or img should probably get a CSS class and the width/height should be in hypha.css.
Why bother with this when you're about to remove the preview entirely?
Maybe this line should be moved way further down, since the
srcvar is only used there (and now it might be confusing with thesrcparameter tocreatePreviewImage().I think this allows deleting arbitrary files, which is a security problem (e.g. consider posting with
src=data/hypha.xml, or maybe even something outside of the docroot).Also, this only deletes the resized image, not the original (if it exists).
@ -477,0 +506,4 @@if ($needResize) {image_resize($destinations[$orgUrlIndex], $destinations['img'], $maxSize[0], $maxSize[1]);}}This silently ignores images that are too big or have an invalid extension.
This should be featured-image rather than excerpt?
fixed
oopsie. good point!
Please: no inline styling...
fixed
@matthijskooijman : yes
@tammoterhark : is all over the file.. I consider this to be out of the scope of this pull request.
Seems logical, but actually this is needed to work properly.
placed the accept at the input field, where it belongs.
fixed
moved styling to css
found a way to fix it
fixed
I agree with all of you comments. And would like to fix this later on.
Image upload to featured image seems to work at first, but after saving the article and re-opening, the image has disappeared.
When I look on disk, the image is there, but it just does not render. Showed to to Laurens.
@ -477,0 +506,4 @@if ($needResize) {image_resize($destinations[$orgUrlIndex], $destinations['img'], $maxSize[0], $maxSize[1]);}}fixed
Some more comments, WIP.
If
$featuredImageData['error']is set, then the upload is completely ignored, without a message to the user. Is that ok? When can this happen? Doesn't this include "File too big"?Maybe use
pathinfohere instead?@ -466,14 +470,49 @@ class peer_reviewed_article extends HyphaDatatypePage {return ['redirect', $this->constructFullPath($this->pagename)];}Why append the upload max filesize, why not use the interpolation support that __ now has?
@ -473,4 +491,4 @@if (!empty($form->errors)) {return $this->editViewRender($request, $form);}This still ignores a failure of
move_uploaded_fileorimage_resize(though that might trigger a PHP error, of course, which might be sufficien).Why wait until here to unlink? If you unlink in the if above, you probably do not need the
$orgImgvariable at all (since before setting a new image you can look at the original value in the XML).Also, this still unlinks only the resized version, not the original (if present).
@ -466,14 +470,49 @@ class peer_reviewed_article extends HyphaDatatypePage {return ['redirect', $this->constructFullPath($this->pagename)];}is also like this in
loadPage()inpages.php(case HyphaRequest::HYPHA_SYSTEM_PAGE_UPLOAD). this needs to be centralised and improved.I've copied the excerpt commit to #299, leaving the featured image commits here for more discussion and improvement. I also rebased this branch on top of #299, which is rebased on top of current master.
Pull request closed