Jump to content

(SOLVED) Strange Error Uploading Image (SQLSTATE[01000]: Warning: 1265 Data truncated for column 'ratio' at row 1)


Recommended Posts

Hello dear PW gurus.

I have stumbled over a strange error that i all of sudden got when trying to upload an image to a images field on a page.
There where images allready stored in the field that i wanted to keep, but during the upload the error apear and after that all images are gone from the field and i can´t upload any, i just get the error every time.

I am running ProcessWire 3.0.153 dev.

Update:

After looking in the assets folder i find the folder for the page and the image files seems to be there including the ones i tried to upload when the error occured.
But they don´t show up in the images field in the page editor.

 

The error reported:
 

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'ratio' at row 1

And here is a screenshot of the event:

img_upload_error.thumb.png.87f33ff8e55e4166cf60a8e79ac760cf.png

The TracyDebugger Error reporting:
tracy_Debugger_upload_image_error.thumb.png.a41846205827adc7a8303669a409dea3.png

I hope you fine folks could point me in a direction.
But it seems our old pal set_time_limit() is back.

Regards, EyeDentify

Edited by EyeDentify
Changed title to convey Solved status.
Link to post
Share on other sites

@adrian and @kongondo

I did some checking and turns out i am running a Maria-DB for my PW install.
one.com does not show me what version of Maria-DB.

i also checked my config file and there i set the following locale:
 

setlocale(LC_ALL, 'sv_SE.utf8', 'sv_SE.UTF-8', 'en_US.UTF-8', 'en_US.utf8');

So what am i doing in the meantime the Imagesfield gets updated to account for this problem?

Do i have to change to English locale?
I rather not have to.

Thanks again.

Link to post
Share on other sites

Its not a long term solution but for now i am using the files field, it at least let me upload files and output them in the template.
But ofcourse i have to do all my image resizing before upload.

I realy wish we could find a solution to this.

Link to post
Share on other sites
1 hour ago, EyeDentify said:

I realy wish we could find a solution to this.

A bug report was filed a week ago. Ryan will get to it and sort it out, I'm sure. Meanwhile, your choices are:

  1. Downgrade your ProcessWire version.
  2. Make the manual db column type change if you can live with it.
  3. Write a hook to convert the value before it is saved  (using a period for decimals) and another hook for display (using comma for decimals) during render.
  4. If you really have to (usually not recommended), change the code in the core knowing full well this will be overwritten when you upgrade.
  • Like 2
Link to post
Share on other sites
49 minutes ago, kongondo said:

A bug report was filed a week ago. Ryan will get to it and sort it out, I'm sure. Meanwhile, your choices are:

  1. Downgrade your ProcessWire version.
  2. Make the manual db column type change if you can live with it.
  3. Write a hook to convert the value before it is saved  (using a period for decimals) and another hook for display (using comma for decimals) during render.
  4. If you really have to (usually not recommended), change the code in the core knowing full well this will be overwritten when you upgrade.

Hello @kongondo

1. is out.
2. I am not sure how to do this whitin PW?
3. Could i get a pointer to how i should go about this?, and why is this comma usefull for an field holding images?
4. Do you know where i should start looking in the code?

In the meanwhile, guess i will have to use files fields.

Thank you.

Link to post
Share on other sites

 

8 hours ago, EyeDentify said:

But it seems our old pal set_time_limit() is back.

This is why I keep saying that PW is not going to be compatible with one.com - there are several places in the core that use it.

  • Like 2
Link to post
Share on other sites
12 hours ago, eydun said:

 

@EyeDentify get a serious host, if you are building a serious application. The money you save on a cheap host, is wasted on time debugging various problems.

 

Some of us do not have that luxery sir. We have to work with what we have.

Link to post
Share on other sites
Just now, EyeDentify said:

Some of us do not have that luxery sir. We have to work with what we have.

You can get a VPS at Linode or Digital Ocean for $5 / month. Throw Server Pilot on that and you have a great setup with all the control you need.

  • Like 1
Link to post
Share on other sites
9 hours ago, bernhard said:

Ryan just pushed a fix for this 🙂 

Sounds great 🙂 How do i apply it? Just download PW 3.0.155 dev?

9 hours ago, bernhard said:

Ryan just pushed a fix for this 🙂 

Yes @adrian i know you have been saying this and your right.
But like i said before, i can´t at the moment.

Link to post
Share on other sites
Just now, EyeDentify said:

But like i said before, i can´t at the moment.

Fair enough - it just sounded strange to call a good host a luxury in response to Eydun's attempt to help, and also to keep bringing up that set_time_limit error. Not everyone reading this thread will know about the other thread where we figured out the cause of that error so it just confounds those trying to help you here - make sense?

  • Like 1
Link to post
Share on other sites
2 minutes ago, adrian said:

Fair enough - it just sounded strange to call a good host a luxury in response to Eydun's attempt to help, and also to keep bringing up that set_time_limit error. Not everyone reading this thread will know about the other thread where we figured out the cause of that error so it just confounds those trying to help you here - make sense?

I hear you @adrian 

but i was not calling one.com luxury, it was more a saying that i did not have the luxury to change right now and have to work with what i got.

There was no ill will towards @eydun i know "he" was trying to help.

Link to post
Share on other sites
1 minute ago, EyeDentify said:

it was more a saying that i did not have the luxury to change right now and have to work with what i got.

Sorry, I thought you were calling a "good host" a luxury.

Anyway, I am sure there are no ill feelings - sorry if I over-analyzed things 🙂

  • Like 1
Link to post
Share on other sites

Thanks to @kongondo @adrian @bernhard and @eydun

That helped me with this.

Following @ryan pushing a fix for this to the PW 3.0.155 dev branch i do not have to pull my hair any longer 🙂

Also @adrian for some reason TracyDebugger is not freaking out about the Console panel anymore even after i applied 3.0.155 dev update.

Knock on wood...

Edited by EyeDentify
changed spelling misstakes.
  • Like 3
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By spercy16
      These issues should be fairly easy for any intermediate to advanced ProcessWire developer to answer. I'm new to PHP and relatively new to ProcessWire and just need a bit of help. What I'm trying to do is bring in a couple of cards from my Projects page to display on my home page. I finally got the code right to bring in the cards but right now they're using my original images instead of my resized "variations". So firstly, I would like to know how to reference the variations of my images instead of using the original. Secondly, I need to grab only four of the cards from the Project page and not import in all ten. It should be just two small changes to my code to do these things (I would imagine). Here is the code I currently have for that section:
      <?php // https://processwire.com/api/arrays/ // check if the array of images has items if (count($pages->get("/projects/")->images)) : // get array of images from the field $images = $pages->get("/projects/")->images; $count = 0; // iterate over each one foreach ($images as $image) : $count++; $sectionText = $pages->get("/projects/")->get("paragraph_$count"); $img = $image; $buttonCode = $pages->get("/projects/")->get("url_$count"); ?> <span id="card<?php echo $count?>" class="card"> <img class="cardThumb" src="<?php echo $img->url; ?>" alt="<?php echo $image->description; ?> Thumbnail" /> <div class="cardBody"> <div class="cardText"> <h2><?php echo $img->description; ?></h2> <?php echo $sectionText; ?> </div> <div class="primaryBtn"> <a href="https://www.paypal.com/donate?hosted_button_id= <?php echo $buttonCode; ?> &source=url"> <button> <i class="fas fa-donate"></i> Donate </button> </a> </div> </div> </span> <?php endforeach; endif; ?> Thanks in advance for any help!
    • By skeltern
      WebP image support is great and works fine. But once created I've issues to get rid of all API generated WebP variations.
      The backend image field variations "Delete" works and I can remove all variations JPEG plus WebP. Image list is clean but all WebP API variations are still stored in file system (for instance files/12345/84.900x675.webp etc). I can only use ImageSizer with temp 'force' option to request fresh WebP variations or have to delete WebP files from folders. No other way so far. Tested with 2 sites and latest master PW 3.0.165.
      Is there somewhere a "magic button" or config/setup thing to solve my sticky WebP issue?
    • By sambadave
      Hi there
      Short version of question
      Let's say I have a page in the admin that contains a field... Is it possible to output the content from that field on another page in the admin? Almost like a reference.
      Longer version of question (with example)
      A house builder with multiple (60+) developments. They want to be able to create notices/messages that can be added to one or many developments. Handy for things like regional covid lockdowns or temporary office closures due to bad weather.
      My approach for the admin editing options:
      Add each message to each development
      Pros: You edit the message on the development page in context
      Cons: Very time consuming and repetitive if the same message needs to be applied to 60+ developments
        Control all the messages from one admin page and say which development each message should be applied to
      Pros: Easier to add/remove messages to more than one development at a time. Control all messages from one place.
      Cons: Content is not added on development page, which is where typical admin users may expect to find it I went for option 2 due to flexibility, and created a page within the admin for global development notices. This contains a repeater with:
      Field for message to display Checkbox list of all developments. The user can select which ones to apply each message to It's working really well but the only thing is that if the user goes to a specific development in the admin, the relevant messages aren't displayed in context (as they aren't edited on that page and instead on the global development notices page)... which may cause confusion when a new staff member / content admin tries to edit the text but there is no field when they go to the development admin page where they expect to see it...
      Solution???
      I don't require the message(s) to also be editable on the development page, but I wondered if there was a nice way to show it/them somehow. I feel like I am missing something really simple as I'm sure ProcessWire will have a nice way of achieving this, or maybe there are field settings that allow this kind of thing to happen?
      Any ideas on approaches or similar experiences would be much appreciated, even if it is just a much simpler example with the content from one field being shown on another admin page to get the ball rolling.
      Thanks in advance for any advice :)
    • By psy
      I've searched, and maybe missed, the solution. I have a 'normal' images field and uploading images with a file size greater than 10Kb is fine. Any image size smaller results in the never-ending spinner and no upload.
      No min/max width/height set on image uploads in admin, ie just the defaults.
      Any ideas on how to fix?
      Using:
      PW: 3.0.175
      PHP: 7.3
      Marking it as "Resolved" rather than "Solved" as it auto-magically fixed itself. No idea whether PW, PHP, or just an internet hiccough... All good now 🤞
    • By picarica
      so hello there i have fiel field type i have lots of stuff there, and also an image i can easily get image from that field using
                                                        
      $options = array('quality' => 85, 'upscaling' => true, 'cropping' => 'north', 'sharpening' => 'medium'); $word = ".png"; // Test if string contains the word foreach($childgames->subor_hry as $file) { if(strpos($file, $word) !== false){ /* $imger = $file->size(473, 266, $options); */ echo $file; /* echo $file->url; */ } } so i get the fiel i tried invoking size on it like the commented out part and it doesnt work i get error Oh snizzle… Error:     Exception: Method Pagefile::size does not exist or is not callable in this context (in
      what am i doing wrong? can you guys help me by all logic this should work
×
×
  • Create New...