Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image didn't show on staging [ rails4.2 + paperclip5.0.0+ ckeditor(5.1.1)] #926

Open
BunnyWeee opened this issue Nov 24, 2022 · 0 comments

Comments

@BunnyWeee
Copy link

BunnyWeee commented Nov 24, 2022

hi guys,

I have some problems with upload images.
This feature worked fine on development.
But I just found, when I upload images on staging, the images file name didn't change.
EX:
image-TheTimeWhenUpload.jpeg => 3218739217309438.jpeg?3712837
I expected when I upload successfully should be compiled and change it file name like above.
my paperclip setting upload to s3.
Actually I can find my upload images on s3, but I just can't find my images on staging.
I have no idea what happened to this,
hope somebody can give me some advise. Really Thanks.

please refer my config.js & log below:

Started POST "/ckeditor/pictures?&responseType=json" for 127.0.0.1 at 2022-11-24 17:01:29 +0800
Processing by Ckeditor::PicturesController#create as */*
  Parameters: {"upload"=>#<ActionDispatch::Http::UploadedFile:0x00007f8cc5b880e0 @tempfile=#<Tempfile:/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/RackMultipart20221124-78413-12izg0o.jpeg>, @original_filename="image-20221124170129-1.jpeg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"upload\"; filename=\"image-20221124170129-1.jpeg\"\r\nContent-Type: image/jpeg\r\n">, "ckCsrfToken"=>"i2PLSD27s812BNm7lZ4Zs49IA5qFdYnfLo4K6LCj", "responseType"=>"json"}
  User Load (1.5ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 6142  ORDER BY `users`.`id` ASC LIMIT 1
Command :: file -b --mime '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-x75rva.jpeg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' 2>/dev/null
Command :: convert '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' -auto-orient -resize "x80" -crop "80x80+25+0" +repage -strip -quality 75 '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/4e12ea25206c9b21d6bdaeb20a2a054f20221124-78413-2ctbkc.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' 2>/dev/null
Command :: convert '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' -auto-orient -resize "450x" -crop "450x235+0+19" +repage -strip -quality 75 '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/4e12ea25206c9b21d6bdaeb20a2a054f20221124-78413-1oube0a.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' 2>/dev/null
Command :: convert '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' -auto-orient -resize "625x" -crop "625x327+0+27" +repage -strip -quality 75 '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/4e12ea25206c9b21d6bdaeb20a2a054f20221124-78413-10dyc0h.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' 2>/dev/null
Command :: convert '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-1c4a2na.jpeg[0]' -auto-orient -resize "1250x" -crop "1250x656+0+53" +repage -strip -quality 75 '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/4e12ea25206c9b21d6bdaeb20a2a054f20221124-78413-azh5kx.jpg'
   (2.9ms)  BEGIN
Command :: file -b --mime '/var/folders/6r/5kznbd5d5jd5djhxyxtn25j00000gp/T/56224af4217cba73bab53f2ad298f03c20221124-78413-ob9e7u.jpeg'
  SQL (9.9ms)  INSERT INTO `ckeditor_assets` (`type`, `data_file_name`, `data_content_type`, `data_file_size`, `data_fingerprint`, `created_at`, `updated_at`) VALUES ('Ckeditor::Picture', 'image-20221124170129-1.jpeg', 'image/jpeg', 141148, '7049aed1f23a1514abe81489a804f0cd', '2022-11-24 09:01:31', '2022-11-24 09:01:31')
   (1.7ms)  COMMIT
Completed 200 OK in 1153ms (Views: 1.0ms | ActiveRecord: 16.0ms)
CKEDITOR.plugins.addExternal(
  "youtube",
  "/assets/ckeditor/plugins/youtube/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "filebrowser",
  "/assets/ckeditor/plugins/filebrowser/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "uploadimage",
  "/assets/ckeditor/plugins/uploadimage/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "image2",
  "/assets/ckeditor/plugins/image2/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "embedbase",
  "/assets/ckeditor/plugins/embedbase/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "embed",
  "/assets/ckeditor/plugins/embed/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "wordcount",
  "/assets/ckeditor/plugins/wordcount/",
  "plugin.js"
);

CKEDITOR.plugins.addExternal(
  "notification",
  "/assets/ckeditor/plugins/notification/",
  "plugin.js"
);


CKEDITOR.editorConfig = function (config) {
  // Define changes to default configuration here. For example:
  config.language = 'zh_TW';
  config.uiColor = '#AADC6E';
  config.embed_provider = '//ckeditor.iframe.ly/api/oembed?url={url}&callback={callback}'

  /* Filebrowser routes */
  // The location of an external file browser, that should be launched when "Browse Server" button is pressed.
  config.filebrowserBrowseUrl = "/ckeditor/attachment_files";

  // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
  config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";

  // The location of a script that handles file uploads in the Flash dialog.
  config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";

  // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
  config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";

  // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
  config.filebrowserImageBrowseUrl = "/ckeditor/pictures";

  // The location of a script that handles file uploads in the Image dialog.
  config.filebrowserImageUploadUrl = "/ckeditor/pictures?";

  // The location of a script that handles file uploads.
  config.filebrowserUploadUrl = "/ckeditor/attachment_files";

  config.allowedContent = true;
  config.filebrowserUploadMethod = 'form';

  config.toolbar_mini = [
    ["Bold",  "Italic",  "Underline",  "Strike",  "-",  "Subscript",  "Superscript"],
  ];

  config.extraPlugins = 'youtube, image2, embedbase, embed, wordcount, notification';
  // config.toolbar = "mini";

  config.wordcount = {
    // Whether or not you Show Remaining Count (if Maximum Word/Char/Paragraphs Count is set)
    showRemaining: false,
    // Whether or not you want to show the Paragraphs Count
    showParagraphs: false,
    // Whether or not you want to show the Word Count
    showWordCount: false,
    // Whether or not you want to show the Char Count
    showCharCount: true,
    // Whether or not you want to Count Bytes as Characters (needed for Multibyte languages such as Korean and Chinese)
	  countBytesAsChars: false,
    // Whether or not you want to count Spaces as Chars
    countSpacesAsChars: false,
    // Whether or not to include Html chars in the Char Count
    countHTML: false,
    // Whether or not to include Line Breaks in the Char Count
    countLineBreaks: false,
    // Whether or not to prevent entering new Content when limit is reached.
	  hardLimit: false,
    // Whether or not to to Warn only When limit is reached. Otherwise content above the limit will be deleted on paste or entering
    warnOnLimitOnly: false,
    // Maximum allowed Word Count, -1 is default for unlimited
    maxWordCount: -1,
    // Maximum allowed Char Count, -1 is default for unlimited
    maxCharCount: 100,
    // Maximum allowed Paragraphs Count, -1 is default for unlimited
    maxParagraphs: -1,
    // How long to show the 'paste' warning, 0 is default for not auto-closing the notification
    pasteWarningDuration: 3000,

    // Add filter to add or remove element before counting (see CKEDITOR.htmlParser.filter), Default value : null (no filter)
    filter: new CKEDITOR.htmlParser.filter({
      elements: {
        div: function( element ) {
            if(element.attributes.class == 'mediaembed') {
                return false;
            }
        }
      }
    })
  };

  // ... rest of the original config.js  ...
};

@BunnyWeee BunnyWeee changed the title image didn't show on staging [ rails4.2 + paperclip5.0.0+ ckeditor4] image didn't show on staging [ rails4.2 + paperclip5.0.0+ ckeditor(5.1.1)] Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant