saveToFile not showing images into gallery - nativescript

I created a nativescript app for camara related app. I am taking a photo using nativescript-camara module.
once user take a photo I am showing that image preview, as well as user can rename that image name. When user save that image I stored into a specific folder and removing preview image which stored by nativescript-camara module.
after that, i can see that image in the gallery but not the original image, I can only blank image in the gallery. I also checked that image is exist on that location where is saved it. That means, Image saving work perfects but not showing that image in the gallery immediately. After 5-10 minutes i can see that image in gallery. But not an immediately.
here is more details with images
https://github.com/NativeScript/nativescript-camera/issues/222

Finally! i solved this issue, I scanned media and its done. Here is my code.
var callback = new android.media.MediaScannerConnection.OnScanCompletedListener({
onScanCompleted: function (path, uri) {
console.log(path)
}
});
android.media.MediaScannerConnection.scanFile(applicationModule.android.context, [path], null, callback);

Related

Open Graph Stories with Big Images

Our app shares a custom open graph story that included a 1200x630px preview image. The preview image however always displays as a small square when posted to the Facebook timeline.
As mentioned here, the header of the website I'm linking to already contains og:image and og:image:width and og:image:height. Still the image is cropped and only a square on the left is visible.
Is there any trick to make the image use the full width? User generated images are not the solution to go for because it removes the link from the open graph object and also stores the image in the user's photo albums.
I know that this has to be possible somehow because it works for apps such as Runtastic Results.

Wordpress upload image size

Kinda new to wordpress.. Creating my own theme. When I upload an image and put it in a post it comes out at 300x183 pixels but the original file I upload is 1800x1100 pixels. Wordpress alters my size when i upload it.This is what i get in the url on the post NDAppleProductMockUp-300x183.jpg.. It restricts the size of the image. When i go into the image properties within the post and click original nothing happens it stays at 300x183.. I have tried to work it out but can't Any suggestions guys..
Thanks
Unfortunately, WordPress does not resize the actual image that you upload. It creates 3 smaller versions of it, leaving the uploaded image untouched. I would suggest that you create all of your images at 1800x1100 before you upload them.
Another solution would be to link to the "big-sized" image when you "Insert into Post"... unfortunately, you would have to know the filename of the large image. I check the source code and this part of the media system does not appear to be pluggable.
Another option may be to check out this plugin:
http://wordpress.org/extend/plugins/nextgen-gallery/
This link here details how You can change what image size will be displayed
http://codex.wordpress.org/Function_Reference/add_image_size
also when u attach to post you can set the image size in the setting
THE SETTING is Before you attach the image!
you are trying to change an image that has already been attached (the attached image was in a mid or small size to begin with) so it is already at its original size.

Images save to saved pics and retrieving back and displaying in my app in windows phone

Hello Friends I am New to WP7
i am working on small app now..
In that App i take one Pic from my camera and trying to save that in saved pictures with some name and i like to retrieve that Images and display again in my App Gallery screen
I am Using Pivot control for this app
in my first PivotItem Name is Gallery and second PivotItem name is Camera
Now i am working with camera fine
After taking my picture from camera i like to add some Note for that and save to my saved images and retrieving same image back and display in Gallery with Note wt i save
can any one say
how can i complete this App in good way
Code for save Images im using
mainpage.xaml.cs
private void saveimg_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
string fileName = myValue.ToShortDateString() + ".jpg";
var library = new MediaLibrary();
//library.SavePictureToCameraRoll(fileName, e.ChosenPhoto);
library.SavePicture(fileName, imageBits);
MessageBox.Show("Photo Saved to Picture Hub");
}
I need to Retrieve that that saved Image and display in my App when it loaded
If you need to access your image once it has been saved in the Media Library, you should also save it to the Isolated Storage.
Here is a tutorial that shows how to do that:
http://www.windowsphonegeek.com/tips/All-about-WP7-Isolated-Storage---Read-and-Save-Images
Save the image to Isolated Storage and Pictures Gallery. When wanting to see the image through the app, use image from Isolated Storage.
No need to use SQLite, use index numbers to save your image in Isolated storage, and also store comments with index numbers, that might ease you.

How do I resize/access original images in wordpress?

Where do the images resize in wordpress? In a database? In a folder?
How would I go about resizing the original image (not create a new version). I ask this, because I uploaded quite a few images that are too large and slow down load times on a wordpress site, and I want to resize them so there aren't any dimensions larger than 1500px.
I've already looked at a few plugins, including "regenerate thumbnails", but there may be one that actually does what I want that I haven't been able to find yet.
Well, the images resize "on the fly", then stored in the server and its information recorded in the database.
The original remains and all "thumbnails" are generated. In this case, "thumbnails" refers to all WP generated image sizes, big or small.
I answered the same question at WordPress StackExchange. And the solution comes from this article: How to automatically use resized images instead of originals.
This script will replace the uploaded image (if bigger than the larger size defined in your settings) by the large image generated by WordPress to save space in your server, and save bandwidth if you link a thumbnail to the original image, like when a lightbox plugin is used.
add_filter('wp_generate_attachment_metadata','replace_uploaded_image');
function replace_uploaded_image($image_data)
{
// if there is no large image : return
if ( !isset($image_data['sizes']['large']) )
return $image_data;
// paths to the uploaded image and the large image
$upload_dir = wp_upload_dir();
$uploaded_image_location = $upload_dir['basedir'] . '/' . $image_data['file'];
$large_image_location = $upload_dir['path'] . '/' . $image_data['sizes']['large']['file'];
// delete the uploaded image
unlink($uploaded_image_location);
// rename the large image
rename($large_image_location, $uploaded_image_location);
// update image metadata and return them
$image_data['width'] = $image_data['sizes']['large']['width'];
$image_data['height'] = $image_data['sizes']['large']['height'];
unset($image_data['sizes']['large']);
return $image_data;
}
You can use WordPress' add_theme_support and add_image_size to add multiple sizes for an image, which means that WordPress will create a copy of the post thumbnail with the specified dimensions when you upload a new thumbnail. To learn more about these technics you can read this tutorial.
There is also another function in WordPress and it's image_resize that can be used to scale down an image to fit a particular size and save a new copy of the image.
Most developers uses add_image_size to add multiple image size to show in different palces, i.e. you can use one image as a featured image in your home page and also can use another size of same image in the single.php page. To do this you have to use
add_theme_support( 'post-thumbnails' );
add_image_size( 'homepage-thumb', 220, 180 ); // 220 pix width,180 pix height
add_image_size( 'singlepost-thumb', 590, 9999 ); // Unlimited Height Mode
To show the homepage-thumb image in your home page you can use
if ( has_post_thumbnail() ) { the_post_thumbnail( 'homepage-thumb' ); }
Or in the single.php template you can use
if ( has_post_thumbnail() ) { the_post_thumbnail( 'singlepost-thumb' ); }
Also you can take a look at this plugin and this article could be useful too. Hope it helps.
To my knowledge there is no plugin that will directly resize your original images and change their meta data, but I've found a workaround (I had a similar problem to yours) which does not require coding.
Download your images by FTP (images are stored within the wp-content/uploads/ directory)
Make your resize/editing operations with the software of your choice and re-upload your images using FTP exactly to the same place they were before (you should not change anything in the folder structure or filenames)
Install WPR Rebuild Meta Data plugin in your Wordpress Admin. Go to "Tools -> Rebuild Meta". This will rebuild all the modified image meta data (for example it will update the new image sizes into the database)
Install Force Regenerate Thumbnails plugin in your Wordpress Admin. You can use it from "Tools -> Force Regenerate Thumbnails" to do it for all your images, or from the Wordpress Media Manager to do it just for the images you've changed. This will delete the old thumbnails and custom image sizes, and create fresh ones from your new images.

How to auto generate custom image sizes

I got strange behaviour when I added filter for attachment_fields_to_save, when I save the images, it does not want to save image metadata such as title, description and caption.
Why I need to add this filter? Because I have lots of custom sizes using this code:
add_image_size("imagesize-940x360", 940, 360, true);
And the image may not correctly put in good place, so the user need to use Wordpress awesome tools to edit the image like cropping and scaling.
For some silly reason (or perhaps this is bug), the Wordpress does not generate image for custom image sizes.
In order to achieve generation for custom sizes, I need to add filter when user press save button in the Wordpress image editor. Here is the piece code that I been using:
add_filter("attachment_fields_to_save", "rl_regenerate_image", 99, 2);
function rl_regenerate_image($post, $attachment)
{
$id = $post['ID'];
$fullsizepath = get_attached_file($id);
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $fullsizepath));
return true;
}
The code above generates the custom sizes when user edit the image correctly but sadly it does not save all updated metadata images such as title, caption and description.
Do you guys know how to solve this problem? So what I would like to achieve is how to generate "edited" images for custom sizes and save the metadata correctly.
Thanks in advance!
In case this hasn't been solved yet, or for any Googler's out there.. Here's a plugin called Post Thumbnail Editor that lets you edit individual custom image sizes. Works well.
http://wordpress.org/extend/plugins/post-thumbnail-editor/

Resources