jeudi 2 avril 2015

What image type is this file?

I have met a file that should be an image. I know the headers of some types, like jpeg, jfif, gif etc, but now I have met a file that I am not sure what it is. It starts with \FF\D8\FF\E1Z\8CExif\00\00II*\00 and somewhere in the first line it has Canon\00Canon EOS 700D and in another place a date and an hour: 2015:03:24 10:23:31. So I am wandering if it is a raw file? The extension is jpg, but this because of renaming of some other program.


Android Resize images according to the screen size of the device

I hope someone can help me. I have days looking for a way to Resize images in android according to the screen size of the device. Sometimes the picture is fine but when used in a slightly larger image comes to be very small and not resized or adapted to the screen size.


For there I saw that for every image that wanted to join the project, was to add image in different sizes, Example: 80x80, 160x160,220x220,320xx320 (each has the same name.) and that helped resized.


Or did so but not me. sometimes the image is totally distorted.


This is the code I use for ImageView



<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/inicio"
android:background="@drawable/inicio1"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:layout_below="@+id/imageView"


/>


that I can do to make the image take an appropriate size according to the size of the screen.


Thank You


how to avoid duplicate images added in the listview

i am doing an app loading currently taken images in the list view, I am able to load the images in the list view,but the problem is the images are repeatedly viewing in the list after 3 items and some tine its view then and there in the imageview.but my need is to add the image in the list when the user took,please help me thanks in advance.


mercredi 1 avril 2015

popup image gallery not working

Hi in the below code displaying image gallery for that these are my sample images.Now,When I was click the image want to show as popup the image with left and right slides.


But,When I was click the image it's opening as a full image not popping the image.


Can any one help me.


html



<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="about.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="sidebar.css" />
<link href="iconic.css" media="screen" rel="stylesheet" type="text/css" />
<script src="js/prefix-free.js"></script>
<script type="text/javascript" src="js/modernizr-1.5.min.js"></script>
<script type="text/javascript" src="http://ift.tt/wV40hO"></script>
<script type="text/javascript" src="http://ift.tt/1M2ZWov"></script>
<script type="text/javascript" src="js/jquery.sidebar.js"></script>
<script src="http://ift.tt/1qRgvOJ"></script>
<link type="text/css" href="http://ift.tt/1vj7D4M" rel="stylesheet" />
<script type="text/javascript" src="http://ift.tt/1wc0thc"></script>
<script type="text/javascript" src="lib/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="source/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css?v=2.1.5" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
/*
* Simple image gallery. Uses default settings
*/

$('.fancybox').fancybox();

/*
* Different effects
*/

// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});

// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect : 'none',
closeEffect : 'none',

helpers : {
title : {
type : 'over'
}
}
});

// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS : 'fancybox-custom',
closeClick : true,

openEffect : 'none',

helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});

// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,

openEffect : 'elastic',
openSpeed : 150,

closeEffect : 'elastic',
closeSpeed : 150,

closeClick : true,

helpers : {
overlay : null
}
});

/*
* Button helper. Disable animations, hide close button, change title type and content
*/

$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',

prevEffect : 'none',
nextEffect : 'none',

closeBtn : false,

helpers : {
title : {
type : 'inside'
},
buttons : {}
},

afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});


/*
* Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/

$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',

closeBtn : false,
arrows : false,
nextClick : true,

helpers : {
thumbs : {
width : 50,
height : 50
}
}
});

/*
* Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',

arrows : false,
helpers : {
media : {},
buttons : {}
}
});

/*
* Open manually
*/

$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});

$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});

$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});


});
</script>
<div id="galery">
<h1>Gallery</h1><br>
<div id="Gallery">

<a class="fancybox" href="img/1_b.jpg" data-fancybox-group="gallery" title="Lorem ipsum dolor sit amet"><img src="img/1_s.jpg" alt="" /></a>

<a class="fancybox" href="img/2_b.jpg" data-fancybox-group="gallery" title="Etiam quis mi eu elit temp"><img src="img/2_s.jpg" alt="" /></a>

<a class="fancybox" href="img/3_b.jpg" data-fancybox-group="gallery" title="Cras neque mi, semper leon"><img src="img/3_s.jpg" alt="" /></a>

<a class="fancybox" href="img/4_b.jpg" data-fancybox-group="gallery" title="Sed vel sapien vel sem uno"><img src="img/4_s.jpg" alt="" /></a>



<a class="fancybox-effects-a" href="img/5_b.jpg" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit"><img src="img/5_s.jpg" alt="" /></a>

<a class="fancybox-effects-b" href="img/5_b.jpg" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit"><img src="img/5_s.jpg" alt="" /></a>

<a class="fancybox-effects-c" href="img/5_b.jpg" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit"><img src="img/5_s.jpg" alt="" /></a>

<a class="fancybox-effects-d" href="img/5_b.jpg" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit"><img src="img/5_s.jpg" alt="" /></a>
</div>
</div>

Save image and text offline in android?

I have multiple activities which consists of listviews with image and text fetched from the server. I need them to be available in when user is offline just like what facebook. I am trying to figure out the best possible way to achieve that?


I currently have 3 approaches in my mind:



  1. Save image as cache and text in shared preference or sqlite and display. But in this case mapping will be difficult.

  2. Save both image and text in SQLITE and display.

  3. Save the images in SD card and display from there.


Which approach should I choose. Or is there any other solution to it?


Wordpress featured image size uniform height

I am setting featured images to posts, and displaying a default image if one isn't set. My code is here...



<?php if ( has_post_thumbnail() ) {
the_post_thumbnail( 'full', array( 'class' => 'img-responsive' ) );
} else { ?>
<img src="default-image.jpg" class="img-responsive" />
<?php } ?>


Problem is simple. All of the images are different heights. I want them all to be uniform height so my bootstrap grid lines up evenly.


Any thoughts? Lots of examples online but none work with featured image AND default image.


Can some one please help me in correcting the mistake I'm making in HTML DOM parsing?

I've one sample string as follows :



$feed_status = Nice to see you all back again <img src=\"http://ift.tt/1BZQwnH\" alt=\"Smile\" title=\"Smile\" title=\"v_middle\" /><img src=\"http://ift.tt/1BZQwnH\" alt=\"Smile\" title=\"Smile\" title=\"v_middle\" /><img src=\"http://ift.tt/1BZQwnH\" alt=\"Smile\" title=\"Smile\" title=\"v_middle\" />;


(Forgive me for syntactical errors like placing of single quotes and double quotes)


For your reference I've just added three <img> tags to the string but in real situation this string could contain a single <img> tag or no <img> tag or more than one <img> tags.


I want to get names of files present in each of the <img> tag's src attribute and make array of those file names. Then I have to replace these <img> tags by strings from an array titled $emoticon_codes which is created dynamically based on the file name present in <img> tag. This replacement of strings should happen is the same order.


For this I've tried following code. Till the creation of dynamic array titled $emoticon_codes everything works fine but I'm facing with code for replacing the current <img> tags with the strings from the array $emoticon_codes. So can somebody please help me in correcting the mistake I'm making in my code while replacing the <img> tags from the string.


Following is my code :



$doc = new DOMDocument();
$doc->loadHTML($feed_status);
$imageTags = $doc->getElementsByTagName('img');

if(count($imageTags)) {
$emoticon_codes = array();
foreach($imageTags as $tag) {
if (basename($tag->getAttribute('src')) == 'evilgrin.png') {
array_push($emoticon_codes, '\ue404');
}
if (basename($tag->getAttribute('src')) == 'grin.png') {
array_push($emoticon_codes, '\ue415');
}
if (basename($tag->getAttribute('src')) == 'happy.png') {
array_push($emoticon_codes, '\ue057');
}
if (basename($tag->getAttribute('src')) == 'smile.png') {
array_push($emoticon_codes, '\ue056');
}
if (basename($tag->getAttribute('src')) == 'surprised.png') {
array_push($emoticon_codes, '\ue107');
}
if (basename($tag->getAttribute('src')) == 'tongue.png') {
array_push($emoticon_codes, '\ue105');
}
if (basename($tag->getAttribute('src')) == 'unhappy.png') {
array_push($emoticon_codes, '\ue403');
}
if (basename($tag->getAttribute('src')) == 'waii.png') {
array_push($emoticon_codes, '\ue407');
}
if (basename($tag->getAttribute('src')) == 'wink.png') {
array_push($emoticon_codes, '\ue405');
}
}
/*Till here everything works fine. The array $emoticon_codes is also getting generated finely*/

/*Following is the code giving problem to me,*/
$t = 0;

foreach($imageTags as $img) {
$img->parentNode->replaceChild($img, $doc->createTextNode($emoticon_codes[$t]));
$t++;
if ($t > count($emoticon_codes)) {
break;
}
}
}


My desired output string should be like follows after echo $feed_status; :


$feed_status = Nice to see you all back again \ue056 \ue056 \ue056;


Thanks in advance.