jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

site-icon is not work on Windows

Open hinaloe opened this issue 12 years ago • 14 comments

I'm running Local Wordpress(multi-site) on Windows8 with PHP5.5 built-in Server... but uploading site icon, but the Image won't show. image

Why?

the image url is (Site-url)/wp-content/uploads/C:User(username)....(wp-dir)contentuploads201411/imagename-s-5470cb28_site_icon-128x128.png

Seem that... \ is been looked escape calactor? why dont'you replace?

ref: normal image upload has no problem.

hinaloe avatar Nov 22 '14 18:11 hinaloe

I'm afraid I can't reproduce on my end. What do you see when looking at your site's source code? Are the following meta tags there:

  • apple-touch-icon-precomposed
  • icon
  • msapplication-TileImage

If so, is their URL correct, or do you see the same problem there?

jeherve avatar Nov 22 '14 19:11 jeherve

Oh... There is same problem...

hinaloe avatar Nov 22 '14 19:11 hinaloe

Thanks for taking a look. I wonder if the problem could be caused by your setup.

What happens if you try using something like XAMPP instead of Windows' built-in PHP server?

jeherve avatar Nov 22 '14 19:11 jeherve

Now, I had tested on XAMPP php5.6.3!

The result is same...

and media Library there... The upload original image! <- This filename has no problem! (When canceled on Resize page) A temp resized image (by Jetpack?) <- The problem URL.

hinaloe avatar Nov 23 '14 14:11 hinaloe

Thanks. I could reproduce the issue as well. It seems it's only happening on local windows installations, so you shouldn't experience the issue on your production site. We'll try to get this fixed.

@enejb I believe something wrong is happening when we first generate the filename here, because I can see the wrong path saved in _wp_attached_file in my database.

screen shot 2014-11-24 at 10 16 02 am

jeherve avatar Nov 24 '14 09:11 jeherve

Thanks for reporting this issue. @jeherve can you see if changing line 674 in jetpack-site-icon.php to 'guid' => wp_normalize_path( $wp_upload_dir['url'] . '/' ) . basename( $filename ), makes a difference. I don't have a Windows server handy to test this out properly.

enejb avatar Nov 28 '14 18:11 enejb

No change, I'm afraid:

screen shot 2014-11-28 at 9 33 12 pm

jeherve avatar Nov 28 '14 20:11 jeherve

@jeherve can you see if this branch fixes your issue. https://github.com/Automattic/jetpack/tree/fix/1327-site-icon-path-issue

Thanks.

enejb avatar Dec 06 '14 01:12 enejb

@enejb I made the changes to my sandbox environment and it fixed the crop/preview but still shows the wrong path on the actual pages and in the general settings:

untitled1 untitled2

CoryCharlton avatar Dec 06 '14 03:12 CoryCharlton

@enejb

Line 388 needs to be updated also:

Original: $site_icon_filename = $image_edit->generate_filename( dechex ( time() ). '_site_icon', $dir['path'] , 'png' );

Fix: $site_icon_filename = $image_edit->generate_filename( dechex ( time() ). '_site_icon', null , 'png' );

I can only test this on a Windows install so can only confirm it plus the checkin above fixes my problem but can't confirm it won't cause others on non-Windows environments :)

CoryCharlton avatar Dec 06 '14 03:12 CoryCharlton

@enejb @machx0r :+1:

hinaloe avatar Dec 06 '14 10:12 hinaloe

@machx0r Thanks for testing! It does indeed seem to fix it for me too, and works on both Windows and Linux environments.

@enejb I added @machx0r 's suggestion to your branch in 615ab4e42670a9c4b3d8d832cf8d1e3ecc0568bc

jeherve avatar Dec 07 '14 09:12 jeherve

Thanks for testing @machx0r @kimama1997 and @jeherve. I also just added another fix. That was preventing the file from being displayed in the Media Library as before. You can find the latest changes here. https://github.com/Automattic/jetpack/commit/906d18822ad825072a91ba1421604240fa02ab7b Can you check that it all works as expected and that when you go to the media library you see the image as if you uploaded it via the regular uploader.

Thank you!

enejb avatar Dec 08 '14 06:12 enejb

I have just tested the branch #1380 on a XAMPP server on Windows 8.1, and every mentioned use case works fine:

  • the image is displayed correctly when cropping;
  • the resulting images are OK;
  • the media library entry has the correct URL as well;

zinigor avatar Dec 08 '14 08:12 zinigor