Grid Block must be a valid PNG file.

Million Dollar Script Forums General Grid Block must be a valid PNG file.

This topic contains 9 replies, has 2 voices, and was last updated by  scubareb 4 years, 9 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #924

    scubareb
    Participant

    Hi Everyone,

    I have successfully changed the block size and now of course I have to upload new grid block images. I have the appropriate size png image, however when I choose it and hit save, I get the following error:

    Error: cannot save due to the following errors:
    – Grid Block must be a valid PNG file.

    I have tried several different files with no avail. Any help will be greatly appreciated!

    I have attached an example of what I am trying to upload:

    Thanks!
    Rebecca

    #926

    Ryan
    Keymaster

    It sounds like the images must be in PNG format.

    #927

    scubareb
    Participant

    Ryan,

    Thanks for the response – but they are. Did you see the image I attached? This is one of the few that fail with the error message..

    #928

    scubareb
    Participant

    In admin/inventory.php I found the following:

    if ($_FILES[‘grid_block’][‘tmp_name’]!=”) {
    if (!is_allowed_grid_file(‘grid_block’)) {
    $error .= “- Grid Block must be a valid PNG file.
    “;
    }
    }

    if ($_FILES[‘nfs_block’][‘tmp_name’]!=”) {
    if (!is_allowed_grid_file(‘nfs_block’)) {
    $error .= “- Not For Sale Block must be a valid PNG file.
    “;
    }
    }

    if ($_FILES[‘usr_grid_block’][‘tmp_name’]!=”) {
    if (!is_allowed_grid_file(‘usr_grid_block’)) {
    $error .= “- Not For Sale Block must be a valid PNG file.
    “;
    }
    }

    if ($_FILES[‘usr_nfs_block’][‘tmp_name’]!=”) {
    if (!is_allowed_grid_file(‘usr_nfs_block’)) {
    $error .= “- User’s Not For Sale Block must be a valid PNG file.
    “;
    }
    }

    if ($_FILES[‘usr_ord_block’][‘tmp_name’]!=”) {
    if (!is_allowed_grid_file(‘usr_ord_block’)) {
    $error .= “- User’s Ordered Block must be a valid PNG file.
    “;
    }
    }

    if ($_FILES[‘usr_res_block’][‘tmp_name’]!=”) {
    if (!is_allowed_grid_file(‘usr_res_block’)) {
    $error .= “- User’s Reserved Block must be a valid PNG file.
    “;
    }
    }

    I removed this entire set – and it allows me to upload.. So there must be an issue with something in this code – any ideas?

    #929

    Ryan
    Keymaster

    Oh, sorry. There is no file attached to your post.

    Maybe just make sure there are no dots in the filename. It might confuse them with the file extension.

    I will modify it in the future to detect the file type rather than go by the extension.

    #930

    scubareb
    Participant

    Ryan,
    The filename I tried was 36×36.png and I also tried just block.png and I got error never had any dots (other then extension).

    As soon as I took out the above code – I have no problems uploading.

    If it matters for your troubleshooting, I am on a Mac.

    #931

    Ryan
    Keymaster

    Thanks. I think I fixed the issue.

    There is an extra in /admin/inventory.php.

    Change line 97 to this:

    [code]$parts = explode (‘.’, $_FILES[$image_name][‘name’]);[/code]

    #932

    scubareb
    Participant

    My line 97 reads this:

    [quote]$parts = explode (‘.’, $_FILES[$image_name][‘name’]); $ext = strtolower(array_pop($parts));
    [/quote]

    Do I not need the $ext = part? Or is that suppose to be line 98?

    #933

    Ryan
    Keymaster

    That looks like 2 lines. The $ext = part is supposed to be the next line. What version of the script are you using?

    This was in the dev snapshot where I fixed it. It should be available in the downloads section now with the fix too.

    #934

    scubareb
    Participant

    Running 2.1 r164

    Looks like I accidentally deleted the line break..

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.